Created
December 12, 2012 20:11
-
-
Save fj/4271122 to your computer and use it in GitHub Desktop.
Prove control was yielded to a block via a particular mechanism
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 C | |
def x(&block) | |
instance_eval &block if block_given? | |
end | |
end | |
describe C do | |
describe "#x" do | |
it "executes the block" do | |
expect{ |p| described_class.x &p }.to yield_control | |
end | |
it "executes the block with instance_eval" do | |
described_class.should_receive :target | |
described_class.x { target } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment