Test the block is called in Factory#run

This commit is contained in:
Joshua Clayton 2011-10-26 23:51:25 -04:00
parent 73b9e4196a
commit 93026a8f2f
1 changed files with 7 additions and 0 deletions

View File

@ -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