From 93026a8f2f456602c76d0c0ed78b4292ddc8b7a9 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 26 Oct 2011 23:51:25 -0400 Subject: [PATCH] Test the block is called in Factory#run --- spec/factory_girl/factory_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/factory_girl/factory_spec.rb b/spec/factory_girl/factory_spec.rb index c191847..e534d34 100644 --- a/spec/factory_girl/factory_spec.rb +++ b/spec/factory_girl/factory_spec.rb @@ -272,4 +272,11 @@ describe FactoryGirl::Factory, "running a factory" do subject.run(FactoryGirl::Proxy::Build, { :name => "John Doe" }) proxy.should have_received(:set).once end + + it "calls the block and returns the result" do + block_run = nil + block = lambda {|result| block_run = "changed" } + subject.run(FactoryGirl::Proxy::Build, { }, &block) + block_run.should == "changed" + end end