Commit 23b35e05 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Use next_instance_of instead of any_instance_of

For prepended classes, we need to use `expect_next_instance_of`
instead of RSpecs `any_instance_of` variants.
parent c6eb18ee
...@@ -120,7 +120,9 @@ describe Admin::ApplicationSettingsController do ...@@ -120,7 +120,9 @@ describe Admin::ApplicationSettingsController do
describe 'verify panel actions' do describe 'verify panel actions' do
shared_examples 'renders correct panels' do shared_examples 'renders correct panels' do
it 'renders correct action on error' do it 'renders correct action on error' do
allow_any_instance_of(ApplicationSettings::UpdateService).to receive(:execute).and_return(false) expect_next_instance_of(ApplicationSettings::UpdateService) do |service|
allow(service).to receive(:execute).and_return(false)
end
patch action, params: { application_setting: { unused_param: true } } patch action, params: { application_setting: { unused_param: true } }
...@@ -128,7 +130,10 @@ describe Admin::ApplicationSettingsController do ...@@ -128,7 +130,10 @@ describe Admin::ApplicationSettingsController do
end end
it 'redirects to same panel on success' do it 'redirects to same panel on success' do
allow_any_instance_of(ApplicationSettings::UpdateService).to receive(:execute).and_return(true) expect_next_instance_of(ApplicationSettings::UpdateService) do |service|
allow(service).to receive(:execute).and_return(true)
end
referer_path = public_send("#{action}_admin_application_settings_path") referer_path = public_send("#{action}_admin_application_settings_path")
request.env["HTTP_REFERER"] = referer_path request.env["HTTP_REFERER"] = referer_path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment