diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-04-12 18:54:23 +0800 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-04-19 14:17:36 +0800 |
commit | 0866a47a349cb89bb0d18eb2347055b1cdcba026 (patch) | |
tree | a93f188c013f5ab9d8f37765702a74058faf634c /spec/features | |
parent | 9ec37d3dc1c1969be743a0c283242dc462a8f466 (diff) | |
download | gitlab-ce-0866a47a349cb89bb0d18eb2347055b1cdcba026.tar.gz |
Show prioritized labels to guests57247-show-prioritized-labels-to-guests
Disables sorting when guests are viewing
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/labels/update_prioritization_spec.rb | 20 | ||||
-rw-r--r-- | spec/features/projects/labels/user_views_labels_spec.rb | 5 |
2 files changed, 21 insertions, 4 deletions
diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index d36f043f880..f32b155790f 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -138,29 +138,41 @@ describe 'Prioritize labels' do end context 'as a guest' do - it 'does not prioritize labels' do + before do + create(:label_priority, project: project, label: bug, priority: 1) + create(:label_priority, project: project, label: feature, priority: 2) + guest = create(:user) sign_in guest visit project_labels_path(project) + end + it 'cannot prioritize labels' do expect(page).to have_content 'bug' expect(page).to have_content 'wontfix' expect(page).to have_content 'feature' - expect(page).not_to have_css('.prioritized-labels') expect(page).not_to have_content 'Star a label' end + + it 'cannot sort prioritized labels', :js do + drag_to(selector: '.prioritized-labels .label-list-item', from_index: 1, to_index: 2) + + page.within('.prioritized-labels') do + expect(first('.label-list-item')).to have_content('bug') + expect(page.all('.label-list-item').last).to have_content('feature') + end + end end context 'as a non signed in user' do - it 'does not prioritize labels' do + it 'cannot prioritize labels' do visit project_labels_path(project) expect(page).to have_content 'bug' expect(page).to have_content 'wontfix' expect(page).to have_content 'feature' - expect(page).not_to have_css('.prioritized-labels') expect(page).not_to have_content 'Star a label' end end diff --git a/spec/features/projects/labels/user_views_labels_spec.rb b/spec/features/projects/labels/user_views_labels_spec.rb index 2c8267764bd..a6f7968c535 100644 --- a/spec/features/projects/labels/user_views_labels_spec.rb +++ b/spec/features/projects/labels/user_views_labels_spec.rb @@ -7,6 +7,7 @@ describe "User views labels" do set(:user) { create(:user) } let(:label_titles) { %w[bug enhancement feature] } + let!(:prioritized_label) { create(:label, project: project, title: 'prioritized-label-name', priority: 1) } before do label_titles.each { |title| create(:label, project: project, title: title) } @@ -18,6 +19,10 @@ describe "User views labels" do end it "shows all labels" do + page.within('.prioritized-labels .manage-labels-list') do + expect(page).to have_content('prioritized-label-name') + end + page.within('.other-labels .manage-labels-list') do label_titles.each { |title| expect(page).to have_content(title) } end |