debian-mirror-gitlab/spec/features/snippets/show_spec.rb

48 lines
1.3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Snippet', :js, feature_category: :source_code_management do
2020-10-24 23:57:45 +05:30
let_it_be(:user) { create(:user) }
let_it_be(:snippet) { create(:personal_snippet, :public, :repository, author: user) }
2017-08-17 22:00:37 +05:30
2020-10-24 23:57:45 +05:30
it_behaves_like 'show and render proper snippet blob' do
let(:anchor) { nil }
2017-08-17 22:00:37 +05:30
2020-10-24 23:57:45 +05:30
subject do
visit snippet_path(snippet, anchor: anchor)
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
end
end
2018-11-18 11:00:15 +05:30
2021-01-03 14:25:43 +05:30
# it_behaves_like 'showing user status' do
# This will be handled in https://gitlab.com/gitlab-org/gitlab/-/issues/262394
2020-01-01 13:55:28 +05:30
2020-10-24 23:57:45 +05:30
it_behaves_like 'does not show New Snippet button' do
let(:file_path) { 'files/ruby/popen.rb' }
2020-01-01 13:55:28 +05:30
2020-10-24 23:57:45 +05:30
subject { visit snippet_path(snippet) }
2020-01-01 13:55:28 +05:30
end
2023-03-17 16:20:25 +05:30
2023-06-20 00:43:36 +05:30
it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :dashboard_snippets_path, :snippets
2023-03-17 16:20:25 +05:30
context 'when unauthenticated' do
2023-05-27 22:25:52 +05:30
it 'shows the "Explore" sidebar' do
2023-03-17 16:20:25 +05:30
visit snippet_path(snippet)
2023-05-27 22:25:52 +05:30
expect(page).to have_css('aside.nav-sidebar[aria-label="Explore"]')
2023-03-17 16:20:25 +05:30
end
end
context 'when authenticated as a different user' do
let_it_be(:different_user) { create(:user) }
before do
sign_in(different_user)
end
2023-06-20 00:43:36 +05:30
it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :dashboard_snippets_path, :snippets
2023-03-17 16:20:25 +05:30
end
2017-08-17 22:00:37 +05:30
end