diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-19 03:12:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-19 03:12:30 +0300 |
commit | 3024d3ac9e2c7242cd3cfce70b6c103f357fa6a9 (patch) | |
tree | edcc7209e241f55d20c195463d1cb7ffdfe66f18 /spec/views | |
parent | 3c5025227f284c91f95bea8dc095efc880b67812 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb b/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb new file mode 100644 index 00000000000..cc3ee52e73b --- /dev/null +++ b/spec/views/devise/shared/_signup_omniauth_provider_list_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'devise/shared/_signup_omniauth_provider_list', feature_category: :system_access do + let_it_be(:provider_label) { :github }.freeze + let_it_be(:tracking_label) { 'free_registration' }.freeze + let_it_be(:tracking_action) { "#{provider_label}_sso" }.freeze + + subject { rendered } + + before do + 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({}) + end + + shared_examples 'sso buttons have snowplow tracking' do + it 'contains tracking attributes' do + css = "[data-track-action='#{tracking_action}']" + css += "[data-track-label='#{tracking_label}']" + + expect(rendered).to have_css(css) + end + end + + context 'when feature flag is true' do + before do + stub_feature_flags(restyle_login_page: true) + + 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 { is_expected.to have_content(_("Create an account using:")) } + + it_behaves_like 'sso buttons have snowplow tracking' + end +end |