Skip to content

Commit

Permalink
Fix RSpec/StubbedMock linting errors
Browse files Browse the repository at this point in the history
This manually fixes the errors by replacing `expect` with `allow`.
  • Loading branch information
thomasleese committed Jul 2, 2024
1 parent bf4ce6c commit 3574fda
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions spec/controllers/history_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

context "with a destination" do
before do
expect_any_instance_of(HistoryStack).to receive(
allow_any_instance_of(HistoryStack).to receive(
:pop_to_origin,
).and_return("/origin")
end
Expand All @@ -26,7 +26,7 @@

context "without a destination" do
before do
expect_any_instance_of(HistoryStack).to receive(
allow_any_instance_of(HistoryStack).to receive(
:pop_to_origin,
).and_return(nil)
end
Expand All @@ -43,7 +43,7 @@

context "with a destination" do
before do
expect_any_instance_of(HistoryStack).to receive(:pop_back).and_return(
allow_any_instance_of(HistoryStack).to receive(:pop_back).and_return(
"/previous",
)
end
Expand All @@ -56,7 +56,7 @@

context "without a destination" do
before do
expect_any_instance_of(HistoryStack).to receive(:pop_back).and_return(
allow_any_instance_of(HistoryStack).to receive(:pop_back).and_return(
nil,
)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/update_dqt_match_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
]

expect(DQT::Client::FindTeachers).to receive(:call).with(
allow(DQT::Client::FindTeachers).to receive(:call).with(
application_form:,
).and_return(results)

Expand Down
12 changes: 6 additions & 6 deletions spec/jobs/update_dqttrn_request_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

context "with a successful response" do
before do
expect(DQT::Client::CreateTRNRequest).to receive(:call).and_return(
allow(DQT::Client::CreateTRNRequest).to receive(:call).and_return(
{
potential_duplicate: false,
trn: "abcdef",
Expand Down Expand Up @@ -58,7 +58,7 @@

context "with a failure response" do
before do
expect(DQT::Client::CreateTRNRequest).to receive(:call).and_raise(
allow(DQT::Client::CreateTRNRequest).to receive(:call).and_raise(
Faraday::BadRequestError.new(StandardError.new),
)
end
Expand Down Expand Up @@ -96,7 +96,7 @@

context "with a potential duplicate response" do
before do
expect(DQT::Client::CreateTRNRequest).to receive(:call).and_return(
allow(DQT::Client::CreateTRNRequest).to receive(:call).and_return(
{ potential_duplicate: true },
)
end
Expand Down Expand Up @@ -134,7 +134,7 @@

context "with a successful response" do
before do
expect(DQT::Client::ReadTRNRequest).to receive(:call).and_return(
allow(DQT::Client::ReadTRNRequest).to receive(:call).and_return(
{
potential_duplicate: false,
trn: "abcdef",
Expand Down Expand Up @@ -171,7 +171,7 @@

context "with a failure response" do
before do
expect(DQT::Client::ReadTRNRequest).to receive(:call).and_raise(
allow(DQT::Client::ReadTRNRequest).to receive(:call).and_raise(
Faraday::BadRequestError.new(StandardError.new),
)
end
Expand Down Expand Up @@ -209,7 +209,7 @@

context "with a potential duplicate response" do
before do
expect(DQT::Client::ReadTRNRequest).to receive(:call).and_return(
allow(DQT::Client::ReadTRNRequest).to receive(:call).and_return(
{ potential_duplicate: true },
)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/dqt/client/create_trn_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:application_form) { create(:application_form) }

before do
expect(DQT::TRNRequestParams).to receive(:call).with(
allow(DQT::TRNRequestParams).to receive(:call).with(
application_form:,
).and_return("body")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

context "with an assessor filter" do
before do
expect_any_instance_of(Filters::Assessor).to receive(
allow_any_instance_of(Filters::Assessor).to receive(
:apply,
).and_return(ApplicationForm.none)
end
Expand All @@ -43,17 +43,17 @@

context "with a country filter" do
before do
expect_any_instance_of(Filters::Country).to receive(
:apply,
).and_return(ApplicationForm.none)
allow_any_instance_of(Filters::Country).to receive(:apply).and_return(
ApplicationForm.none,
)
end

it { is_expected.to be_empty }
end

context "with a name filter" do
before do
expect_any_instance_of(Filters::Name).to receive(:apply).and_return(
allow_any_instance_of(Filters::Name).to receive(:apply).and_return(
ApplicationForm.none,
)
end
Expand All @@ -63,7 +63,7 @@

context "with a reference filter" do
before do
expect_any_instance_of(Filters::Reference).to receive(
allow_any_instance_of(Filters::Reference).to receive(
:apply,
).and_return(ApplicationForm.none)
end
Expand All @@ -73,7 +73,7 @@

context "with an action required by filter" do
before do
expect_any_instance_of(Filters::ActionRequiredBy).to receive(
allow_any_instance_of(Filters::ActionRequiredBy).to receive(
:apply,
).and_return(ApplicationForm.none)
end
Expand All @@ -83,17 +83,17 @@

context "with a stage filter" do
before do
expect_any_instance_of(Filters::ShowAll).to receive(
:apply,
).and_return(ApplicationForm.none)
allow_any_instance_of(Filters::ShowAll).to receive(:apply).and_return(
ApplicationForm.none,
)
end

it { is_expected.to be_empty }
end

context "with show all filter" do
before do
expect_any_instance_of(Filters::Stage).to receive(:apply).and_return(
allow_any_instance_of(Filters::Stage).to receive(:apply).and_return(
ApplicationForm.none,
)
end
Expand Down

0 comments on commit 3574fda

Please sign in to comment.