Commit fe6e2b98 authored by Peter Leitzen's avatar Peter Leitzen

Verify that Incidents were visible for guest users as well

parent 605796d6
...@@ -13,12 +13,17 @@ RSpec.describe 'New/edit issue', :js do ...@@ -13,12 +13,17 @@ RSpec.describe 'New/edit issue', :js do
let_it_be(:label2) { create(:label, project: project) } let_it_be(:label2) { create(:label, project: project) }
let_it_be(:issue) { create(:issue, project: project, assignees: [user], milestone: milestone) } let_it_be(:issue) { create(:issue, project: project, assignees: [user], milestone: milestone) }
before do let(:current_user) { user }
stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
before_all do
project.add_maintainer(user) project.add_maintainer(user)
project.add_maintainer(user2) project.add_maintainer(user2)
sign_in(user) end
before do
stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
sign_in(current_user)
end end
describe 'new issue' do describe 'new issue' do
...@@ -234,24 +239,35 @@ RSpec.describe 'New/edit issue', :js do ...@@ -234,24 +239,35 @@ RSpec.describe 'New/edit issue', :js do
end end
describe 'displays issue type options in the dropdown' do describe 'displays issue type options in the dropdown' do
shared_examples 'type option is visible' do |label:, identifier:|
it "shows #{identifier} option", :aggregate_failures do
page.within('[data-testid="issue-type-select-dropdown"]') do
expect(page).to have_selector(%([data-testid="issue-type-#{identifier}-icon"]))
expect(page).to have_content(label)
end
end
end
before do before do
page.within('.issue-form') do page.within('.issue-form') do
click_button 'Issue' click_button 'Issue'
end end
end end
it 'correctly displays the Issue type option with an icon', :aggregate_failures do it_behaves_like 'type option is visible', label: 'Issue', identifier: :issue
page.within('[data-testid="issue-type-select-dropdown"]') do it_behaves_like 'type option is visible', label: 'Incident', identifier: :incident
expect(page).to have_selector('[data-testid="issue-type-issue-icon"]')
expect(page).to have_content('Issue')
end
end
it 'correctly displays the Incident type option with an icon', :aggregate_failures do context 'when user is guest' do
page.within('[data-testid="issue-type-select-dropdown"]') do let_it_be(:guest) { create(:user) }
expect(page).to have_selector('[data-testid="issue-type-incident-icon"]')
expect(page).to have_content('Incident') let(:current_user) { guest }
before_all do
project.add_guest(guest)
end end
it_behaves_like 'type option is visible', label: 'Issue', identifier: :issue
it_behaves_like 'type option is visible', label: 'Incident', identifier: :incident
end 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