summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/labels_controller_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-18 20:31:42 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-18 20:31:42 +0800
commit578ced29f24f9c0db3159d366a974927fbe3946b (patch)
tree21c33c421b2b435e31eb2923a66563f80bb9eb40 /spec/controllers/projects/labels_controller_spec.rb
parent6d1c5761cd520f3cb7fa4dbb1a1937c29f468884 (diff)
parent688ff26df3f288e5cd50096a01014188a5e4011b (diff)
downloadgitlab-ce-578ced29f24f9c0db3159d366a974927fbe3946b.tar.gz
Merge remote-tracking branch 'upstream/master' into fix-cancelling-pipelines
* upstream/master: (162 commits) Grapify the repository API Fix wrong link URL Add note pointing to limitations section in environments.md Clarify the limitation for special chars is for Review Apps Change order of limitations list in environments.md Add an example of invalid characters to branches for review apps Grammar fix in environments.md: s/base/basis Add changelog entry for #24276 / !7500 Allow registering users where the username contains dots (.). bump rouge to 2.0.7 Fix indentation Update copy.md with issue guideline updates and merge request guidelines Refactor github import to reduce number of API calls Fix missing URL from environments docs Check all namespaces on validation of new username. Allow sorting groups in API Use the public CE repo URL instead of the one used in the runner Fix typos Fix wrong changelog item Add missing item for 8.13.6 ...
Diffstat (limited to 'spec/controllers/projects/labels_controller_spec.rb')
-rw-r--r--spec/controllers/projects/labels_controller_spec.rb30
1 files changed, 23 insertions, 7 deletions
diff --git a/spec/controllers/projects/labels_controller_spec.rb b/spec/controllers/projects/labels_controller_spec.rb
index 8faecec0063..ec6cea5c0f4 100644
--- a/spec/controllers/projects/labels_controller_spec.rb
+++ b/spec/controllers/projects/labels_controller_spec.rb
@@ -72,14 +72,8 @@ describe Projects::LabelsController do
end
describe 'POST #generate' do
- let(:admin) { create(:admin) }
-
- before do
- sign_in(admin)
- end
-
context 'personal project' do
- let(:personal_project) { create(:empty_project) }
+ let(:personal_project) { create(:empty_project, namespace: user.namespace) }
it 'creates labels' do
post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project.to_param
@@ -96,4 +90,26 @@ describe Projects::LabelsController do
end
end
end
+
+ describe 'POST #toggle_subscription' do
+ it 'allows user to toggle subscription on project labels' do
+ label = create(:label, project: project)
+
+ toggle_subscription(label)
+
+ expect(response).to have_http_status(200)
+ end
+
+ it 'allows user to toggle subscription on group labels' do
+ group_label = create(:group_label, group: group)
+
+ toggle_subscription(group_label)
+
+ expect(response).to have_http_status(200)
+ end
+
+ def toggle_subscription(label)
+ post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label.to_param
+ end
+ end
end