Skip to content

Commit

Permalink
Fix missing mock in RepositoriesController test
Browse files Browse the repository at this point in the history
A Processing is created unconditionally, and therefore, always needs to
be mocked, even when an error will immediately be thrown.
  • Loading branch information
danielkza committed Jul 26, 2016
1 parent ddd2357 commit e22c3fe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spec/controllers/repositories_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down

0 comments on commit e22c3fe

Please sign in to comment.