From e22c3fecf1768a177dc34f65f57cd6d8fa69c9ec Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Sat, 16 Jul 2016 09:59:32 -0300 Subject: [PATCH] Fix missing mock in RepositoriesController test A Processing is created unconditionally, and therefore, always needs to be mocked, even when an error will immediately be thrown. --- spec/controllers/repositories_controller_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index a48f08c..c7e2506 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -173,9 +173,9 @@ end describe 'process' do - context 'with a successful processing' do - let!(:processing) { FactoryGirl.build(:processing) } + let(:processing) { FactoryGirl.build(:processing) } + context 'with a successful processing' do before :each do Processing.expects(:create).with(repository: repository, state: "PREPARING").returns(processing) Repository.expects(:find).with(repository.id).returns(repository) @@ -189,6 +189,7 @@ context 'with an unsuccessful processing' do before :each do + Processing.expects(:create).with(repository: repository, state: "PREPARING").returns(processing) Repository.expects(:find).with(repository.id).returns(repository) repository.expects(:process).raises(Errors::ProcessingError)