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

show_spec.rb « snippets « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bbb120edb80967782a9945e6963a6b73254b69b0 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Snippet', :js, feature_category: :source_code_management do
  let_it_be(:user) { create(:user, :no_super_sidebar) }
  let_it_be(:snippet) { create(:personal_snippet, :public, :repository, author: user) }

  before do
    stub_feature_flags(super_sidebar_logged_out: false)
  end

  it_behaves_like 'show and render proper snippet blob' do
    let(:anchor) { nil }

    subject do
      visit snippet_path(snippet, anchor: anchor)

      wait_for_requests
    end
  end

  # it_behaves_like 'showing user status' do
  # This will be handled in https://gitlab.com/gitlab-org/gitlab/-/issues/262394

  it_behaves_like 'does not show New Snippet button' do
    let(:file_path) { 'files/ruby/popen.rb' }

    subject { visit snippet_path(snippet) }
  end

  it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :dashboard_snippets_path, :snippets

  context 'when unauthenticated' do
    it 'shows the "Explore" sidebar' do
      visit snippet_path(snippet)

      expect(page).to have_css('aside.nav-sidebar[aria-label="Explore"]')
    end
  end

  context 'when authenticated as a different user' do
    let_it_be(:different_user) { create(:user, :no_super_sidebar) }

    before do
      sign_in(different_user)
    end

    it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :dashboard_snippets_path, :snippets
  end
end