Skip to content

Commit

Permalink
Fix for RSpec/StringAsInstanceDoubleConstant
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Oct 7, 2024
1 parent 6bdd288 commit 087fbb9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions spec/controllers/renewals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rails_helper'

RSpec.describe RenewalsController do
let(:api_response) { instance_double('Response', status: 201, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 201) }
let(:mock_client) do
instance_double(FolioClient, renew_item_by_id: api_response, ping: true)
end
Expand Down Expand Up @@ -42,7 +42,7 @@
end

context 'when the response is not 201' do
let(:api_response) { instance_double('Response', status: 401, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 401) }

it 'does not renew the item and sets flash messages' do
post :create, params: { item_id: '123' }
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/requests_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
end

describe '#update' do
let(:api_response) { instance_double('Response', status: 204, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 204) }

let(:requests) do
[instance_double(Folio::Request, key: '123')]
Expand Down Expand Up @@ -138,7 +138,7 @@
end

describe '#destroy' do
let(:api_response) { instance_double('Response', status: 204, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 204) }
let(:mock_client) { instance_double(FolioClient, cancel_request: api_response, ping: true) }

let(:requests) do
Expand All @@ -162,7 +162,7 @@
end

context 'when the response is not 204' do
let(:api_response) { instance_double('Response', status: 401, content_type: :json, body: 'foo') }
let(:api_response) { instance_double(Faraday::Response, status: 401, body: 'foo') }

it 'does not cancel the hold and sets flash messages' do
delete :destroy, params: { id: '123' }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/renew_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
build(:service_points)
end

let(:api_response) { instance_double('Response', status: 201, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 201) }
let(:bulk_renew_response) do
{ success: [instance_double(Folio::Checkout, key: '1', renewable?: true, item_id: '123', title: 'ABC')] }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build(:service_points)
end

let(:api_response) { instance_double('Response', status: 204, content_type: :json) }
let(:api_response) { instance_double(Faraday::Response, status: 204) }

before do
allow(FolioClient).to receive(:new).and_return(mock_client)
Expand Down

0 comments on commit 087fbb9

Please sign in to comment.