Add helper method to toggle label subscription on labels controller spec

parent 0c052f11
...@@ -95,7 +95,7 @@ describe Projects::LabelsController do ...@@ -95,7 +95,7 @@ describe Projects::LabelsController do
it 'allows user to toggle subscription on project labels' do it 'allows user to toggle subscription on project labels' do
label = create(:label, project: project) label = create(:label, project: project)
post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label.id toggle_subscription(label)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
...@@ -103,9 +103,13 @@ describe Projects::LabelsController do ...@@ -103,9 +103,13 @@ describe Projects::LabelsController do
it 'allows user to toggle subscription on group labels' do it 'allows user to toggle subscription on group labels' do
group_label = create(:group_label, group: group) group_label = create(:group_label, group: group)
post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project.to_param, id: group_label.id toggle_subscription(group_label)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end 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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment