summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-18 15:44:58 -0600
committerDouwe Maan <douwe@selenight.nl>2016-07-18 15:44:58 -0600
commitaba558a4a8c7e9e3c691c0e689a0926d4604a26a (patch)
tree34f75775af7a8cddd6390bf43ba1be00d7f6aa2c /spec
parent4b6e6d0ad222e0fbacf300975be961fcbc7bdccd (diff)
parent36dc4a5ce74dfd76a4acd7580fabec43ede1a254 (diff)
downloadgitlab-ce-aba558a4a8c7e9e3c691c0e689a0926d4604a26a.tar.gz
Merge branch 'caironoleto/gitlab-ce-cn-issue-19747'
Diffstat (limited to 'spec')
-rw-r--r--spec/services/issues/bulk_update_service_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/services/issues/bulk_update_service_spec.rb b/spec/services/issues/bulk_update_service_spec.rb
index 4a689e64dc5..ba3a4dfc048 100644
--- a/spec/services/issues/bulk_update_service_spec.rb
+++ b/spec/services/issues/bulk_update_service_spec.rb
@@ -262,4 +262,42 @@ describe Issues::BulkUpdateService, services: true do
end
end
end
+
+ describe :subscribe_issues do
+ let(:issues) { create_list(:issue, 5, project: project) }
+ let(:params) do
+ {
+ subscription_event: 'subscribe',
+ issues_ids: issues.map(&:id).join(',')
+ }
+ end
+
+ it 'subscribes the given user' do
+ issues.each do |issue|
+ expect(issue.subscribed?(user)).to be_truthy
+ end
+ end
+ end
+
+ describe :unsubscribe_issues do
+ let(:issues) { create_list(:closed_issue, 5, project: project) }
+ let(:params) do
+ {
+ subscription_event: 'unsubscribe',
+ issues_ids: issues.map(&:id).join(',')
+ }
+ end
+
+ before do
+ issues.each do |issue|
+ issue.subscriptions.create(user: user, subscribed: true)
+ end
+ end
+
+ it 'unsubscribes the given user' do
+ issues.each do |issue|
+ expect(issue.subscribed?(user)).to be_falsey
+ end
+ end
+ end
end