Skip to content

Instantly share code, notes, and snippets.

@lazyatom
Created June 25, 2010 23:08
Show Gist options
  • Save lazyatom/453576 to your computer and use it in GitHub Desktop.
Save lazyatom/453576 to your computer and use it in GitHub Desktop.
context "Given a bunch of stuff" do
setup do
@thing = Factory(:thingy)
@user = Factory(:user)
@user.register_with(@thing)
end
# THIS is the code I'm actually testing, isolated from the rest of the setup
action("the user activates the thing") do
@user.activate(@thing)
end
should_change("the thing's colour") { @thing.colour }
should "not allow the thing to be activated again" do
assert_raises(AlreadyActivated) { @user.activate(@thing) }
end
# etc...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment