Skip to content

Instantly share code, notes, and snippets.

@fj
Created December 12, 2012 20:11
Show Gist options
  • Save fj/4271122 to your computer and use it in GitHub Desktop.
Save fj/4271122 to your computer and use it in GitHub Desktop.
Prove control was yielded to a block via a particular mechanism
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