examples/rr/probe_creator_example.rb in rr-0.1.5 vs examples/rr/probe_creator_example.rb in rr-0.1.6
- old
+ new
@@ -76,8 +76,20 @@
@creator.foobar(1, 2).twice
@subject.foobar(1, 2).should == :baz
@subject.foobar(1, 2).should == :baz
proc {@subject.foobar(1, 2)}.should raise_error(Errors::TimesCalledError)
end
+
+ it "sets after_call on the scenario when passed a block" do
+ real_value = Object.new
+ (class << @subject; self; end).class_eval do
+ define_method(:foobar) {real_value}
+ end
+ @creator.foobar(1, 2) {|value| mock(value).a_method {99}}
+
+ return_value = @subject.foobar(1, 2)
+ return_value.should === return_value
+ return_value.a_method.should == 99
+ end
end
end
\ No newline at end of file