Skip to content

Instantly share code, notes, and snippets.

@bangline
Created October 14, 2012 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bangline/3889906 to your computer and use it in GitHub Desktop.
Save bangline/3889906 to your computer and use it in GitHub Desktop.
Invariant example
describe "taking one down" do
Given(:beers_on_the_wall){ BeersOnTheWall.new(beer_count) }
Invariant{(beers_on_the_wall.count == "no more bottles of beers on the wall").should == (beers_on_the_wall.beers == 0)}
When{ beers_on_the_wall.take_one_down }
context "while we still have beers" do
Then{ expect(beers_on_the_wall.count).to eql (beer_count - 1) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment