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

34 lines
1.1 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'rails_helper'
2018-11-08 19:23:39 +05:30
describe 'Explore Snippets' do
2017-08-17 22:00:37 +05:30
let!(:public_snippet) { create(:personal_snippet, :public) }
let!(:internal_snippet) { create(:personal_snippet, :internal) }
let!(:private_snippet) { create(:personal_snippet, :private) }
2018-11-08 19:23:39 +05:30
it 'User should see snippets that are not private' do
2017-09-10 17:25:29 +05:30
sign_in create(:user)
2017-08-17 22:00:37 +05:30
visit explore_snippets_path
expect(page).to have_content(public_snippet.title)
expect(page).to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
2018-11-08 19:23:39 +05:30
it 'External user should see only public snippets' do
2017-09-10 17:25:29 +05:30
sign_in create(:user, :external)
2017-08-17 22:00:37 +05:30
visit explore_snippets_path
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
2018-11-08 19:23:39 +05:30
it 'Not authenticated user should see only public snippets' do
2017-08-17 22:00:37 +05:30
visit explore_snippets_path
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
end