Skip to content
Snippets Groups Projects
Commit b279c22f authored by Imre (Admin)'s avatar Imre (Admin)
Browse files

Merge branch '767-fix-signup-box-test' into 'master'

Fix JH skipped signup box tests

See merge request gitlab-org/gitlab!87224
parents baceff89 fe85d938
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,28 +3,41 @@
require 'spec_helper'
 
RSpec.describe 'devise/shared/_signup_box' do
let(:button_text) { '_button_text_' }
let(:terms_path) { '_terms_path_' }
let(:translation_com) do
s_("SignUp|By clicking %{button_text}, I agree that I have read and accepted "\
"the GitLab %{link_start}Terms of Use and Privacy Policy%{link_end}")
end
let(:translation_non_com) do
s_("SignUp|By clicking %{button_text}, I agree that I have read and accepted "\
"the %{link_start}Terms of Use and Privacy Policy%{link_end}")
end
before do
stub_devise
allow(view).to receive(:show_omniauth_providers).and_return(false)
allow(view).to receive(:url).and_return('_url_')
allow(view).to receive(:terms_path).and_return('_terms_path_')
allow(view).to receive(:button_text).and_return('_button_text_')
allow(view).to receive(:terms_path).and_return(terms_path)
allow(view).to receive(:button_text).and_return(button_text)
allow(view).to receive(:signup_username_data_attributes).and_return({})
stub_template 'devise/shared/_error_messages.html.haml' => ''
end
 
def text(translation)
format(translation,
button_text: button_text,
link_start: "<a href='#{terms_path}' target='_blank' rel='noreferrer noopener'>",
link_end: '</a>')
end
context 'when terms are enforced' do
before do
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:enforce_terms?).and_return(true)
end
 
it 'shows expected text with placeholders' do
render
expect(rendered).to have_content('By clicking _button_text_')
expect(rendered).to have_link('Terms of Use and Privacy Policy')
end
context 'when on .com' do
before do
allow(Gitlab).to receive(:com?).and_return(true)
Loading
Loading
@@ -33,7 +46,7 @@ RSpec.describe 'devise/shared/_signup_box' do
it 'shows expected GitLab text' do
render
 
expect(rendered).to have_content('I have read and accepted the GitLab Terms')
expect(rendered).to include(text(translation_com))
end
end
 
Loading
Loading
@@ -45,7 +58,7 @@ RSpec.describe 'devise/shared/_signup_box' do
it 'shows expected text without GitLab' do
render
 
expect(rendered).to have_content('I have read and accepted the Terms')
expect(rendered).to include(text(translation_non_com))
end
end
end
Loading
Loading
@@ -59,7 +72,7 @@ RSpec.describe 'devise/shared/_signup_box' do
it 'shows expected text with placeholders' do
render
 
expect(rendered).not_to have_content('By clicking')
expect(rendered).not_to include(text(translation_com))
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment