diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/views/layouts/snippets.html.haml_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/views/layouts/snippets.html.haml_spec.rb')
-rw-r--r-- | spec/views/layouts/snippets.html.haml_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/views/layouts/snippets.html.haml_spec.rb b/spec/views/layouts/snippets.html.haml_spec.rb new file mode 100644 index 00000000000..69378906bcd --- /dev/null +++ b/spec/views/layouts/snippets.html.haml_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/snippets', feature_category: :snippets do + before do + allow(view).to receive(:current_user).and_return(user) + allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user)) + end + + describe 'sidebar' do + context 'when feature flag is on' do + context 'when signed in' do + let(:user) { build_stubbed(:user) } + + it 'renders the "Your work" sidebar' do + render + + expect(rendered).to have_css('aside.nav-sidebar[aria-label="Your work"]') + end + end + + context 'when not signed in' do + let(:user) { nil } + + it 'renders no sidebar' do + render + + expect(rendered).not_to have_css('aside.nav-sidebar') + end + end + end + + context 'when feature flag is off' do + before do + stub_feature_flags(your_work_sidebar: false) + end + + let(:user) { build_stubbed(:user) } + + it 'renders no sidebar' do + render + + expect(rendered).not_to have_css('aside.nav-sidebar') + end + end + end +end |