Commit 2ca32a09 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Add test for the case when user can't prioritize labels

parent a966e6e4
...@@ -3,6 +3,7 @@ require 'spec_helper' ...@@ -3,6 +3,7 @@ require 'spec_helper'
feature 'Prioritize labels', feature: true do feature 'Prioritize labels', feature: true do
include WaitForAjax include WaitForAjax
context 'when project belongs to user' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, name: 'test', namespace: user.namespace) } let(:project) { create(:project, name: 'test', namespace: user.namespace) }
...@@ -75,4 +76,33 @@ feature 'Prioritize labels', feature: true do ...@@ -75,4 +76,33 @@ feature 'Prioritize labels', feature: true do
expect(page.all('li').last).to have_content('bug') expect(page.all('li').last).to have_content('bug')
end end
end end
end
context 'as a guest' do
it 'can not prioritize labels' do
user = create(:user)
guest = create(:user)
project = create(:project, name: 'test', namespace: user.namespace)
create(:label, title: 'bug')
login_as guest
visit namespace_project_labels_path(project.namespace, project)
expect(page).not_to have_css('.prioritized-labels')
end
end
context 'as a non signed in user' do
it 'can not prioritize labels' do
user = create(:user)
project = create(:project, name: 'test', namespace: user.namespace)
create(:label, title: 'bug')
visit namespace_project_labels_path(project.namespace, project)
expect(page).not_to have_css('.prioritized-labels')
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