2019-06-25 18:32:54 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe RecaptchaExperimentHelper, type: :helper do
|
2020-05-29 14:08:26 -04:00
|
|
|
let(:session) { {} }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(helper).to receive(:session) { session }
|
|
|
|
end
|
|
|
|
|
2019-06-25 18:32:54 -04:00
|
|
|
describe '.show_recaptcha_sign_up?' do
|
|
|
|
context 'when reCAPTCHA is disabled' do
|
|
|
|
it 'returns false' do
|
|
|
|
stub_application_setting(recaptcha_enabled: false)
|
|
|
|
|
|
|
|
expect(helper.show_recaptcha_sign_up?).to be(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when reCAPTCHA is enabled' do
|
|
|
|
it 'returns true' do
|
|
|
|
stub_application_setting(recaptcha_enabled: true)
|
|
|
|
|
|
|
|
expect(helper.show_recaptcha_sign_up?).to be(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|