Commit 39aa3d86 authored by peterhegman's avatar peterhegman

Apply reviewer feedback

Add spec for when Auditor is part of the project
parent 3032eef8
......@@ -2,21 +2,35 @@
require 'spec_helper'
RSpec.describe 'Issues > User sees empty state' do
RSpec.describe 'Issues' do
let_it_be(:project) { create(:project, :public) }
let_it_be(:auditor) { create(:user, auditor: true) }
shared_examples 'empty state' do |expect_button|
it "shows empty state #{expect_button ? 'with' : 'without'} \"New issue\" button" do
visit project_issues_path(project)
expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project')
expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page.has_link?('New issue')).to be(expect_button)
end
end
context 'when signed in user is an Auditor' do
before do
sign_in(auditor)
end
it 'shows empty state without "New issue" button' do
visit project_issues_path(project)
context 'when user is not a member of the project' do
it_behaves_like 'empty state', false
end
expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project')
expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page).not_to have_link('New issue')
context 'when user is a member of the project' do
before do
project.add_guest(auditor)
end
it_behaves_like 'empty state', true
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment