diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 18:15:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 18:15:54 +0300 |
commit | a4bc9e75d8078f37e9c196333a3a1484e97d6a71 (patch) | |
tree | afa40a4da70aaa3715a9e5f104ec9a36f15aede9 /spec/views | |
parent | a4db97517ad095914c0652a07486ac607d99dab4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
3 files changed, 24 insertions, 100 deletions
diff --git a/spec/views/devise/sessions/new.html.haml_spec.rb b/spec/views/devise/sessions/new.html.haml_spec.rb index 5f611ae1d8f..61a3581852e 100644 --- a/spec/views/devise/sessions/new.html.haml_spec.rb +++ b/spec/views/devise/sessions/new.html.haml_spec.rb @@ -2,71 +2,36 @@ require 'spec_helper' -RSpec.describe 'devise/sessions/new' do - describe 'marketing text', :saas do - subject { render(template: 'devise/sessions/new', layout: 'layouts/devise') } +RSpec.describe 'devise/sessions/new', feature_category: :system_access do + describe 'ldap' do + include LdapHelpers + + let(:server) { { provider_name: 'ldapmain', label: 'LDAP' }.with_indifferent_access } before do + enable_ldap stub_devise disable_captcha - stub_feature_flags(restyle_login_page: false) + disable_sign_up + disable_other_signin_methods end - it 'when flash is anything it renders marketing text' do - flash[:notice] = "You can't do that" - - subject + it 'is shown when enabled' do + render - expect(rendered).to have_content('A complete DevOps platform') + expect(rendered).to have_selector('.new-session-tabs') + expect(rendered).to have_selector('[data-testid="ldap-tab"]') + expect(rendered).to have_field(_('Username')) end - it 'when flash notice is devise confirmed message it hides marketing text' do - flash[:notice] = t(:confirmed, scope: [:devise, :confirmations]) - - subject - - expect(rendered).not_to have_content('A complete DevOps platform') - end - end - - flag_values = [true, false] - flag_values.each do |val| - context "with #{val}" do - before do - stub_feature_flags(restyle_login_page: val) - end - - describe 'ldap' do - include LdapHelpers - - let(:server) { { provider_name: 'ldapmain', label: 'LDAP' }.with_indifferent_access } - - before do - enable_ldap - stub_devise - disable_captcha - disable_sign_up - disable_other_signin_methods - end - - it 'is shown when enabled' do - render - - expect(rendered).to have_selector('.new-session-tabs') - expect(rendered).to have_selector('[data-testid="ldap-tab"]') - expect(rendered).to have_field(_('Username')) - end - - it 'is not shown when LDAP sign in is disabled' do - disable_ldap_sign_in + it 'is not shown when LDAP sign in is disabled' do + disable_ldap_sign_in - render + render - expect(rendered).to have_content('No authentication methods configured') - expect(rendered).not_to have_selector('[data-testid="ldap-tab"]') - expect(rendered).not_to have_field(_('Username')) - end - end + expect(rendered).to have_content('No authentication methods configured') + expect(rendered).not_to have_selector('[data-testid="ldap-tab"]') + expect(rendered).not_to have_field(_('Username')) end end diff --git a/spec/views/devise/shared/_signup_box.html.haml_spec.rb b/spec/views/devise/shared/_signup_box.html.haml_spec.rb index eba036083be..13beb87c383 100644 --- a/spec/views/devise/shared/_signup_box.html.haml_spec.rb +++ b/spec/views/devise/shared/_signup_box.html.haml_spec.rb @@ -81,22 +81,6 @@ RSpec.describe 'devise/shared/_signup_box' do end end - context 'using the borderless option' do - let(:border_css_classes) { '.gl-border-gray-100.gl-border-1.gl-border-solid.gl-rounded-base' } - - it 'renders with a border by default' do - render - - expect(rendered).to have_selector(border_css_classes) - end - - it 'renders without a border when borderless is truthy' do - render('devise/shared/signup_box', borderless: true) - - expect(rendered).not_to have_selector(border_css_classes) - end - end - def stub_devise allow(view).to receive(:devise_mapping).and_return(Devise.mappings[:user]) allow(view).to receive(:resource).and_return(spy) diff --git a/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb b/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb index c3e4bd76b30..988f2e2df8a 100644 --- a/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb +++ b/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb @@ -13,6 +13,7 @@ RSpec.describe 'devise/shared/_signup_omniauth_provider_list', feature_category: allow(view).to receive(:providers).and_return([provider_label]) allow(view).to receive(:tracking_label).and_return(tracking_label) allow(view).to receive(:glm_tracking_params).and_return({}) + render end shared_examples 'sso buttons have snowplow tracking' do @@ -24,37 +25,11 @@ RSpec.describe 'devise/shared/_signup_omniauth_provider_list', feature_category: end end - context 'when feature flag is true' do - before do - stub_feature_flags(restyle_login_page: true) + it { is_expected.to have_content(_("Register with:")) } - render - end - - it { is_expected.to have_content(_("Register with:")) } - - it_behaves_like 'sso buttons have snowplow tracking' - end - - context 'when feature flag is false' do - before do - stub_feature_flags(restyle_login_page: false) - - render - end + it_behaves_like 'sso buttons have snowplow tracking' - it { is_expected.to have_content(_("Create an account using:")) } - - it_behaves_like 'sso buttons have snowplow tracking' - end - - context 'when rendering button' do - before do - render - end - - it 'renders button in form' do - expect(rendered).to have_css('form[action="/users/auth/github"]') - end + it 'renders button in form' do + expect(rendered).to have_css('form[action="/users/auth/github"]') end end |