Skip to content

Instantly share code, notes, and snippets.

@rauchy
Created March 16, 2012 12:08
Show Gist options
  • Save rauchy/2049794 to your computer and use it in GitHub Desktop.
Save rauchy/2049794 to your computer and use it in GitHub Desktop.
Positive and Negative Assertions
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
class User
def visit(attraction)
# ...
end
def visited_attractions_count
# ...
end
end
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