From 3a1e06d6a2494af5449abfee9fb49d56a0f3fe00 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Fri, 15 Dec 2017 14:59:35 -0200 Subject: Create merge request spec --- qa/spec/factory/dependency_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'qa/spec/factory') diff --git a/qa/spec/factory/dependency_spec.rb b/qa/spec/factory/dependency_spec.rb index 32405415126..8aaa6665a18 100644 --- a/qa/spec/factory/dependency_spec.rb +++ b/qa/spec/factory/dependency_spec.rb @@ -54,6 +54,19 @@ describe QA::Factory::Dependency do expect(factory).to have_received(:mydep=).with(dependency) end + + context 'when receives a caller factory as block argument' do + let(:dependency) { QA::Factory::Base } + + it 'calls given block with dependency factory and caller factory' do + allow_any_instance_of(QA::Factory::Base).to receive(:fabricate!).and_return(factory) + allow(QA::Factory::Product).to receive(:populate!).and_return(spy('any')) + + subject.build! + + expect(block).to have_received(:call).with(an_instance_of(QA::Factory::Base), factory) + end + end end end end -- cgit v1.2.1