Created
December 1, 2010 15:13
-
-
Save webdevotion/723613 to your computer and use it in GitHub Desktop.
working code for the "Rails 3 in action" ebook ( chapter 2 - section 2.3.1 )
This file contains 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 Bacon | |
attr_accessor :expired | |
def edible? | |
!expired | |
end | |
def expired! | |
self.expired = true | |
end | |
end |
This file contains 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 'spec_helper' | |
describe Bacon do | |
subject{Bacon.new} | |
its(:edible?) { should be_true } | |
it "expired!" do | |
subject.expired! | |
subject.should_not be_edible | |
end | |
end |
This file contains 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 'bacon' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment