summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-06-27 10:16:29 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-06-27 10:16:29 +0000
commitcefa4dc0cff29b5376a640b46978221fe8b0391a (patch)
tree18cdff22cea2a9ad97f5ad347f47b1d11a84076a /spec
parent22dc7e9cb73f9add38712d4cf6dff3cb58527432 (diff)
parent28785488e8586f6fa4bf22b4773f7fb0ad663815 (diff)
downloadgitlab-ce-cefa4dc0cff29b5376a640b46978221fe8b0391a.tar.gz
Merge branch 'fix-33991' into 'master'
Allow users to subscribe to group labels on the group labels page Closes #33991 See merge request !12402
Diffstat (limited to 'spec')
-rw-r--r--spec/features/groups/labels/subscription_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/features/groups/labels/subscription_spec.rb b/spec/features/groups/labels/subscription_spec.rb
new file mode 100644
index 00000000000..8b891c52d08
--- /dev/null
+++ b/spec/features/groups/labels/subscription_spec.rb
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+feature 'Labels subscription', feature: true do
+ let(:user) { create(:user) }
+ let(:group) { create(:group) }
+ let!(:feature) { create(:group_label, group: group, title: 'feature') }
+
+ context 'when signed in' do
+ before do
+ group.add_developer(user)
+ gitlab_sign_in user
+ end
+
+ scenario 'users can subscribe/unsubscribe to group labels', js: true do
+ visit group_labels_path(group)
+
+ expect(page).to have_content('feature')
+
+ within "#group_label_#{feature.id}" do
+ expect(page).not_to have_button 'Unsubscribe'
+
+ click_button 'Subscribe'
+
+ expect(page).not_to have_button 'Subscribe'
+ expect(page).to have_button 'Unsubscribe'
+
+ click_button 'Unsubscribe'
+
+ expect(page).to have_button 'Subscribe'
+ expect(page).not_to have_button 'Unsubscribe'
+ end
+ end
+ end
+
+ context 'when not signed in' do
+ it 'users can not subscribe/unsubscribe to labels' do
+ visit group_labels_path(group)
+
+ expect(page).to have_content 'feature'
+ expect(page).not_to have_button('Subscribe')
+ end
+ end
+
+ def click_link_on_dropdown(text)
+ find('.dropdown-group-label').click
+
+ page.within('.dropdown-group-label') do
+ find('a.js-subscribe-button', text: text).click
+ end
+ end
+end