0
0
Fork 0

Fix RSpec/StubbedMock cop (#25552)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Matt Jankowski 2023-07-12 04:20:10 -04:00 committed by GitHub
parent 2e1391fdd2
commit 6c5a2233a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 31 deletions

View file

@ -18,10 +18,13 @@ describe StatusFinder do
it 'raises an error if action is not :show' do
recognized = Rails.application.routes.recognize_path(url)
expect(recognized).to receive(:[]).with(:action).and_return(:create)
expect(Rails.application.routes).to receive(:recognize_path).with(url).and_return(recognized)
allow(recognized).to receive(:[]).with(:action).and_return(:create)
allow(Rails.application.routes).to receive(:recognize_path).with(url).and_return(recognized)
expect { subject.status }.to raise_error(ActiveRecord::RecordNotFound)
expect(Rails.application.routes).to have_received(:recognize_path)
expect(recognized).to have_received(:[])
end
end