debian-mirror-gitlab/spec/helpers/recaptcha_helper_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
666 B
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-01-29 00:20:46 +05:30
RSpec.describe RecaptchaHelper, type: :helper do
2020-06-23 00:09:42 +05:30
let(:session) { {} }
before do
allow(helper).to receive(:session) { session }
end
2019-09-30 21:07:59 +05:30
describe '.show_recaptcha_sign_up?' do
context 'when reCAPTCHA is disabled' do
it 'returns false' do
stub_application_setting(recaptcha_enabled: false)
2021-11-11 11:23:49 +05:30
expect(helper.show_recaptcha_sign_up?).to be_falsey
2019-09-30 21:07:59 +05:30
end
end
context 'when reCAPTCHA is enabled' do
it 'returns true' do
stub_application_setting(recaptcha_enabled: true)
2021-11-11 11:23:49 +05:30
expect(helper.show_recaptcha_sign_up?).to be_truthy
2019-09-30 21:07:59 +05:30
end
end
end
end