Welcome to mirror list, hosted at ThFree Co, Russian Federation.

snippets.html.haml_spec.rb « layouts « views « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e6963a6526964351afcc23dc877d8269c16c287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'layouts/snippets', feature_category: :source_code_management 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 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
end