2017-09-18 03:52:28 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
describe 'Projects > Snippets > User views snippets' do
|
2017-09-18 03:52:28 -04:00
|
|
|
let(:project) { create(:project) }
|
|
|
|
let!(:project_snippet) { create(:project_snippet, project: project, author: user) }
|
|
|
|
let!(:snippet) { create(:snippet, author: user) }
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:snippets) { [project_snippet, snippet] } # Used by the shared examples
|
2017-09-18 03:52:28 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-09-18 03:52:28 -04:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_snippets_path(project))
|
|
|
|
end
|
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
context 'pagination' do
|
|
|
|
before do
|
|
|
|
create(:project_snippet, project: project, author: user)
|
|
|
|
allow(Snippet).to receive(:default_per_page).and_return(1)
|
|
|
|
|
|
|
|
visit project_snippets_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'paginated snippets'
|
|
|
|
end
|
|
|
|
|
2017-09-18 03:52:28 -04:00
|
|
|
it 'shows snippets' do
|
|
|
|
expect(page).to have_content(project_snippet.title)
|
|
|
|
expect(page).not_to have_content(snippet.title)
|
|
|
|
end
|
|
|
|
end
|