Skip to content

Commit

Permalink
Use string class names for instance doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
thatbudakguy committed Jun 6, 2022
1 parent 91cd85a commit 8666d4b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 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, type: :controller do
let(:api_response) { instance_double('Response', status: 200, content_type: :json) }
let(:api_response) { instance_double(Response, status: 200, content_type: :json) }
let(:mock_client) do
instance_double(SymphonyClient, renew_item: api_response, ping: true)
end
Expand Down Expand Up @@ -40,7 +40,7 @@
end

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

it 'does not renew the item and sets flash messages' do
post :create, params: { resource: 'abc', item_key: '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 @@ -78,7 +78,7 @@
end

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

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

describe '#destroy' do
let(:api_response) { instance_double('Response', status: 200, content_type: :json) }
let(:api_response) { instance_double(Response, status: 200, content_type: :json) }
let(:mock_client) { instance_double(SymphonyClient, cancel_hold: api_response, ping: true) }

let(:requests) do
Expand Down Expand Up @@ -182,7 +182,7 @@
end

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

it 'does not cancel the hold and sets flash messages' do
delete :destroy, params: { resource: 'abc', id: '123' }
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/reset_pins_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
end

context 'when everything is good' do
let(:response) { instance_double('Response', status: 200, content_type: :json) }
let(:response) { instance_double(Response, status: 200, content_type: :json) }
let(:mock_client) { instance_double(SymphonyClient, change_pin: response, ping: true) }

it 'changes the pin and sets flash messages' do
Expand All @@ -57,7 +57,7 @@
end

context 'when the response is not 200' do
let(:response) { instance_double('Response', status: 401, content_type: :json) }
let(:response) { instance_double(Response, status: 401, content_type: :json) }
let(:mock_client) { instance_double(SymphonyClient, change_pin: response, ping: true) }

it 'does not change the pin and sets flash messages' do
Expand Down
2 changes: 1 addition & 1 deletion spec/services/symphony_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
context 'when symphony returns no patron info' do
before do
allow(client).to receive(:authenticated_request).and_return(
instance_double('HTTP::Response', body: unavailable[:body], status: unavailable[:status])
instance_double(HTTP::Response, body: unavailable[:body], status: unavailable[:status])
)
end

Expand Down

0 comments on commit 8666d4b

Please sign in to comment.