Stub controller methods and remove rubocop:disable
in captcha feature spec (#27743)
This commit is contained in:
parent
2d39268bc5
commit
2862ad701f
@ -7,11 +7,7 @@ describe 'email confirmation flow when captcha is enabled' do
|
|||||||
let(:client_app) { nil }
|
let(:client_app) { nil }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
# rubocop:disable RSpec/AnyInstance -- easiest way to deal with that that I know of
|
allow(Auth::ConfirmationsController).to receive(:new).and_return(stubbed_controller)
|
||||||
allow_any_instance_of(Auth::ConfirmationsController).to receive(:captcha_enabled?).and_return(true)
|
|
||||||
allow_any_instance_of(Auth::ConfirmationsController).to receive(:check_captcha!).and_return(true)
|
|
||||||
allow_any_instance_of(Auth::ConfirmationsController).to receive(:render_captcha).and_return(nil)
|
|
||||||
# rubocop:enable RSpec/AnyInstance
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the user signed up through an app' do
|
context 'when the user signed up through an app' do
|
||||||
@ -40,4 +36,12 @@ describe 'email confirmation flow when captcha is enabled' do
|
|||||||
expect(page).to have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri)
|
expect(page).to have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def stubbed_controller
|
||||||
|
Auth::ConfirmationsController.new.tap do |controller|
|
||||||
|
allow(controller).to receive_messages(captcha_enabled?: true, check_captcha!: true, render_captcha: nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user