Created
May 7, 2011 16:54
-
-
Save aeden/960637 to your computer and use it in GitHub Desktop.
Extraction Blog Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact < ActiveRecord::Base | |
belongs_to :user | |
def name | |
"#{first_name} #{last_name}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'lib/logic/contact' | |
class FakeContact | |
include Logic::Contact | |
attr_accessor :first_name, :last_name | |
end | |
describe Logic::Contact do | |
subject do | |
contact = FakeContact.new | |
contact.first_name = "Anthony" | |
contact.last_name = "Eden" | |
contact | |
end | |
it "has a name" do | |
subject.name.should eq("#{subject.first_name} #{subject.last_name}") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Domain < ActiveRecord::Base | |
# ...lots of code... | |
def auto_renew? | |
registry_domain.auto_renew? | |
rescue => e | |
logger.error e | |
false | |
end | |
# ... more code ... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact < ActiveRecord::Base | |
include Logic::Contact | |
belongs_to :user | |
end | |
module Logic | |
module Contact | |
def name | |
"#{first_name} #{last_name}" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Domain < ActiveRecord::Base | |
include Logic::Domain::Renewable | |
end | |
module Logic | |
module Domain | |
module Renewable | |
def auto_renew? | |
registry_domain.auto_renew? | |
rescue => e | |
logger.error e | |
false | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment