diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-31 06:10:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-31 06:10:52 +0300 |
commit | 2f3007bc70786204d82739e0775ad0f6707ddbc1 (patch) | |
tree | c4597f5283fca092d3e903cc43a508571fd96e24 /spec/helpers/application_helper_spec.rb | |
parent | a3df40b2c393e1540d237938240ee12d2774cd13 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index be3a9767ed4..757f832faa4 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -679,42 +679,74 @@ RSpec.describe ApplicationHelper do end describe '#page_class' do + let_it_be(:user) { build(:user) } + subject(:page_class) do helper.page_class.flatten end - before do - allow(helper).to receive(:current_user).and_return(nil) + describe 'with-header' do + using RSpec::Parameterized::TableSyntax + + before do + allow(helper).to receive(:show_super_sidebar?).and_return(show_super_sidebar) + allow(helper).to receive(:current_user).and_return(current_user) + end + + where(:show_super_sidebar, :current_user) do + true | nil + false | ref(:user) + false | nil + end + + with_them do + it { is_expected.to include('with-header') } + end + + context 'when with-header should not be shown' do + let(:show_super_sidebar) { true } + let(:current_user) { user } + + it { is_expected.not_to include('with-header') } + end end - it { is_expected.not_to include('logged-out-marketing-header') } + describe 'with-top-bar' do + context 'when show_super_sidebar? is true' do + context 'when @hide_top_bar_padding is false' do + before do + allow(helper).to receive(:show_super_sidebar?).and_return(true) + helper.instance_variable_set(:@hide_top_bar_padding, false) + end - context 'when show_super_sidebar? is true' do - context 'when @hide_top_bar_padding is false' do - before do - allow(helper).to receive(:show_super_sidebar?).and_return(true) - helper.instance_variable_set(:@hide_top_bar_padding, false) + it { is_expected.to include('with-top-bar') } end - it { is_expected.to include('with-top-bar') } + context 'when @hide_top_bar_padding is true' do + before do + allow(helper).to receive(:show_super_sidebar?).and_return(true) + helper.instance_variable_set(:@hide_top_bar_padding, true) + end + + it { is_expected.not_to include('with-top-bar') } + end end - context 'when @hide_top_bar_padding is true' do + context 'when show_super_sidebar? is false' do before do - allow(helper).to receive(:show_super_sidebar?).and_return(true) - helper.instance_variable_set(:@hide_top_bar_padding, true) + allow(helper).to receive(:show_super_sidebar?).and_return(false) end it { is_expected.not_to include('with-top-bar') } end end - context 'when show_super_sidebar? is false' do + describe 'logged-out-marketing-header' do before do - allow(helper).to receive(:show_super_sidebar?).and_return(false) + allow(helper).to receive(:current_user).and_return(nil) end - it { is_expected.not_to include('with-top-bar') } + it { is_expected.not_to include('logged-out-marketing-header') } end end |