Commit 58edf0cd authored by Alex Buijs's avatar Alex Buijs

Disable invisible captcha by default in tests

Signing up fails in tests when the signup form is submitted
to quick, so disable it by default in tests.
parent 63d389e9
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
require 'spec_helper' require 'spec_helper'
describe RegistrationsController do describe RegistrationsController do
before do
stub_feature_flags(invisible_captcha: false)
end
describe '#create' do describe '#create' do
context 'when the user opted-in' do context 'when the user opted-in' do
let(:user_params) { { user: attributes_for(:user, email_opted_in: '1') } } let(:user_params) { { user: attributes_for(:user, email_opted_in: '1') } }
......
...@@ -45,7 +45,6 @@ describe TrialRegistrationsController do ...@@ -45,7 +45,6 @@ describe TrialRegistrationsController do
describe '#create' do describe '#create' do
before do before do
stub_feature_flags(invisible_captcha: false)
stub_application_setting(send_user_confirmation_email: true) stub_application_setting(send_user_confirmation_email: true)
end end
......
...@@ -5,10 +5,6 @@ require 'spec_helper' ...@@ -5,10 +5,6 @@ require 'spec_helper'
describe 'Signup on EE' do describe 'Signup on EE' do
let(:user_attrs) { attributes_for(:user) } let(:user_attrs) { attributes_for(:user) }
before do
stub_feature_flags(invisible_captcha: false)
end
context 'for Gitlab.com' do context 'for Gitlab.com' do
before do before do
expect(Gitlab).to receive(:com?).and_return(true).at_least(:once) expect(Gitlab).to receive(:com?).and_return(true).at_least(:once)
......
...@@ -7,7 +7,6 @@ describe 'Trial Sign Up', :js do ...@@ -7,7 +7,6 @@ describe 'Trial Sign Up', :js do
describe 'on GitLab.com' do describe 'on GitLab.com' do
before do before do
stub_feature_flags(invisible_captcha: false)
stub_feature_flags(improved_trial_signup: true) stub_feature_flags(improved_trial_signup: true)
allow(Gitlab).to receive(:com?).and_return(true).at_least(:once) allow(Gitlab).to receive(:com?).and_return(true).at_least(:once)
end end
......
...@@ -7,7 +7,6 @@ describe 'Trial Capture Lead', :js do ...@@ -7,7 +7,6 @@ describe 'Trial Capture Lead', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(invisible_captcha: false)
stub_feature_flags(improved_trial_signup: true) stub_feature_flags(improved_trial_signup: true)
allow(Gitlab).to receive(:com?).and_return(true).at_least(:once) allow(Gitlab).to receive(:com?).and_return(true).at_least(:once)
sign_in(user) sign_in(user)
......
...@@ -9,7 +9,6 @@ describe 'Trial Select Namespace', :js do ...@@ -9,7 +9,6 @@ describe 'Trial Select Namespace', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(invisible_captcha: false)
stub_feature_flags(improved_trial_signup: true) stub_feature_flags(improved_trial_signup: true)
allow(Gitlab).to receive(:com?).and_return(true).at_least(:once) allow(Gitlab).to receive(:com?).and_return(true).at_least(:once)
sign_in(user) sign_in(user)
......
...@@ -114,9 +114,14 @@ describe RegistrationsController do ...@@ -114,9 +114,14 @@ describe RegistrationsController do
context 'when invisible captcha is enabled' do context 'when invisible captcha is enabled' do
before do before do
stub_feature_flags(invisible_captcha: true) stub_feature_flags(invisible_captcha: true)
InvisibleCaptcha.timestamp_enabled = true
InvisibleCaptcha.timestamp_threshold = treshold InvisibleCaptcha.timestamp_threshold = treshold
end end
after do
InvisibleCaptcha.timestamp_enabled = false
end
let(:treshold) { 4 } let(:treshold) { 4 }
let(:session_params) { { invisible_captcha_timestamp: form_rendered_time.iso8601 } } let(:session_params) { { invisible_captcha_timestamp: form_rendered_time.iso8601 } }
let(:form_rendered_time) { Time.current } let(:form_rendered_time) { Time.current }
......
...@@ -10,7 +10,6 @@ describe 'Invites' do ...@@ -10,7 +10,6 @@ describe 'Invites' do
let(:group_invite) { group.group_members.invite.last } let(:group_invite) { group.group_members.invite.last }
before do before do
stub_feature_flags(invisible_captcha: false)
project.add_maintainer(owner) project.add_maintainer(owner)
group.add_user(owner, Gitlab::Access::OWNER) group.add_user(owner, Gitlab::Access::OWNER)
group.add_developer('user@example.com', owner) group.add_developer('user@example.com', owner)
......
...@@ -5,10 +5,6 @@ require 'spec_helper' ...@@ -5,10 +5,6 @@ require 'spec_helper'
shared_examples 'Signup' do shared_examples 'Signup' do
include TermsHelper include TermsHelper
before do
stub_feature_flags(invisible_captcha: false)
end
let(:new_user) { build_stubbed(:user) } let(:new_user) { build_stubbed(:user) }
describe 'username validation', :js do describe 'username validation', :js do
...@@ -396,20 +392,14 @@ describe 'With experimental flow' do ...@@ -396,20 +392,14 @@ describe 'With experimental flow' do
it_behaves_like 'Signup' it_behaves_like 'Signup'
describe 'when role is required' do describe 'when role is required' do
let(:user) { create(:user) } it 'redirects to step 2 of the signup process, updates the user, sets the name and role and then redirects to the requested url' do
user = create(:user)
before do
user.set_role_required! user.set_role_required!
user.reload
sign_in(user) sign_in(user)
visit new_project_path visit new_project_path
end
it 'is redirected to step 2 of the signup process' do expect(current_path).to eq users_sign_up_welcome_path
expect(page).to have_text("Welcome to GitLab.com#{user.username}!")
end
it 'updates the user, sets the name and role and redirects to the requested url' do
fill_in 'user_name', with: 'New name' fill_in 'user_name', with: 'New name'
select 'Software Developer', from: 'user_role' select 'Software Developer', from: 'user_role'
click_button 'Get started!' click_button 'Get started!'
......
...@@ -379,3 +379,6 @@ end ...@@ -379,3 +379,6 @@ end
# Prevent Rugged from picking up local developer gitconfig. # Prevent Rugged from picking up local developer gitconfig.
Rugged::Settings['search_path_global'] = Rails.root.join('tmp/tests').to_s Rugged::Settings['search_path_global'] = Rails.root.join('tmp/tests').to_s
# Disable timestamp checks for invisible_captcha
InvisibleCaptcha.timestamp_enabled = false
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