diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-22 23:11:14 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-26 17:55:52 -0300 |
commit | af6c01fb6f94f1e95972f928edcdce7518d3a4a0 (patch) | |
tree | a4c7d370d15ce2eac32f39ffbddbbc0798c92b8c /spec/features/groups | |
parent | b7ea3ce467534f185961dd2ad6afc2b5f70b7436 (diff) | |
download | gitlab-ce-af6c01fb6f94f1e95972f928edcdce7518d3a4a0.tar.gz |
Allow users to subscribe to group labels on group labels page
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/labels/subscription_spec.rb | 51 |
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..1e19f781644 --- /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 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 |