Created
March 16, 2012 12:08
-
-
Save rauchy/2049794 to your computer and use it in GitHub Desktop.
Positive and Negative Assertions
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
describe User do | |
describe '#visit' do | |
it 'increases the visited attractions count after one visit' do | |
subject.visit('Rome') | |
subject.visited_attractions_count.should == 1 | |
end | |
it "doesn't increase the visited attractions count after several visits" do | |
5.times { subject.visit('Rome') } | |
subject.visited_attractions_count.should_not > 1 | |
end | |
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
class User | |
def visit(attraction) | |
# ... | |
end | |
def visited_attractions_count | |
# ... | |
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
describe User do | |
describe '#visit' do | |
it 'increases the visited attractions count after one visit' do | |
subject.visit('Rome') | |
subject.visited_attractions_count.should == 1 | |
end | |
it "doesn't increase the visited attractions count after several visits" do | |
5.times { subject.visit('Rome') } | |
subject.visited_attractions_count.should == 1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment