Created
December 13, 2010 10:15
-
-
Save lazyatom/738863 to your computer and use it in GitHub Desktop.
Hmm.
This file contains hidden or 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
context "a thing" do | |
setup do | |
@mailer = TestMailer.new | |
@thing = Thing.new(@mailer) | |
end | |
should "send an email when poked" do | |
@mailer.expects(:send_email) | |
@thing.poke | |
end | |
should "increase the poke count" do | |
previous_poke_count = @thing.poke_count | |
@thing.poke | |
assert_equal previous_poke_count + 1, @thing.poke_count | |
end | |
should "be marked as poked" do | |
@thing.poke | |
assert @thing.poked? | |
end | |
end | |
# vs | |
context "a thing" do | |
setup do | |
@mailer = TestMailer.new | |
@thing = Thing.new(@mailer) | |
end | |
doing { @thing.poke } | |
expect "an email to be sent" { @mailer.expects(:send_email)} | |
should_change { @thing.poke_count } | |
should "be marked as poked" { assert @thing.poked? } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment