2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
RSpec.describe 'registrations/welcome/show' do
|
2021-04-29 21:17:54 +05:30
|
|
|
let(:is_gitlab_com) { false }
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_user).and_return(user)
|
|
|
|
allow(view).to receive(:in_subscription_flow?).and_return(false)
|
|
|
|
allow(view).to receive(:in_trial_flow?).and_return(false)
|
2021-04-29 21:17:54 +05:30
|
|
|
allow(view).to receive(:user_has_memberships?).and_return(false)
|
2020-11-24 15:15:51 +05:30
|
|
|
allow(view).to receive(:in_oauth_flow?).and_return(false)
|
2021-04-29 21:17:54 +05:30
|
|
|
allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { rendered }
|
|
|
|
|
|
|
|
it { is_expected.not_to have_selector('label[for="user_setup_for_company"]') }
|
|
|
|
it { is_expected.to have_button('Get started!') }
|
2021-04-29 21:17:54 +05:30
|
|
|
it { is_expected.to have_selector('input[name="user[email_opted_in]"]') }
|
|
|
|
|
|
|
|
describe 'email opt in' do
|
|
|
|
context 'when on gitlab.com' do
|
|
|
|
let(:is_gitlab_com) { true }
|
|
|
|
|
|
|
|
it 'hides the email-opt in by default' do
|
|
|
|
expect(subject).to have_css('.js-email-opt-in.hidden')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when not on gitlab.com' do
|
|
|
|
let(:is_gitlab_com) { false }
|
|
|
|
|
|
|
|
it 'hides the email-opt in by default' do
|
|
|
|
expect(subject).not_to have_css('.js-email-opt-in.hidden')
|
|
|
|
expect(subject).to have_css('.js-email-opt-in')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|