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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.8 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
2023-03-04 22:38:38 +05:30
RSpec.describe 'User Snippets', feature_category: :source_code_management do
2017-08-17 22:00:37 +05:30
let(:author) { create(:user) }
let!(:public_snippet) { create(:personal_snippet, :public, author: author, title: "This is a public snippet") }
let!(:internal_snippet) { create(:personal_snippet, :internal, author: author, title: "This is an internal snippet") }
let!(:private_snippet) { create(:personal_snippet, :private, author: author, title: "This is a private snippet") }
2018-11-08 19:23:39 +05:30
before do
2017-09-10 17:25:29 +05:30
sign_in author
2017-08-17 22:00:37 +05:30
visit dashboard_snippets_path
end
2021-02-22 17:27:13 +05:30
it 'view all of my snippets' do
2020-01-01 13:55:28 +05:30
expect(page).to have_link(public_snippet.title, href: snippet_path(public_snippet))
expect(page).to have_link(internal_snippet.title, href: snippet_path(internal_snippet))
expect(page).to have_link(private_snippet.title, href: snippet_path(private_snippet))
2017-08-17 22:00:37 +05:30
end
2021-02-22 17:27:13 +05:30
it 'view my public snippets' do
2022-01-26 12:08:38 +05:30
page.within('.js-snippets-nav-tabs') do
2017-08-17 22:00:37 +05:30
click_link "Public"
end
expect(page).to have_content(public_snippet.title)
expect(page).not_to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
2021-02-22 17:27:13 +05:30
it 'view my internal snippets' do
2022-01-26 12:08:38 +05:30
page.within('.js-snippets-nav-tabs') do
2017-08-17 22:00:37 +05:30
click_link "Internal"
end
expect(page).not_to have_content(public_snippet.title)
expect(page).to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
2021-02-22 17:27:13 +05:30
it 'view my private snippets' do
2022-01-26 12:08:38 +05:30
page.within('.js-snippets-nav-tabs') do
2017-08-17 22:00:37 +05:30
click_link "Private"
end
expect(page).not_to have_content(public_snippet.title)
expect(page).not_to have_content(internal_snippet.title)
expect(page).to have_content(private_snippet.title)
end
end