Commit 387d1fd0 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-post-push-rule' into 'master'

Fix creation of push rules via POST API

Closes #2820

See merge request !2367
parents 16a0ee10 86ed8b3d
---
title: Fix creation of push rules via POST API
merge_request:
author:
......@@ -42,7 +42,7 @@ module API
if user_project.push_rule
error!("Project push rule exists", 422)
else
push_rule = user_project.create_push_rule(declared_params)
push_rule = user_project.create_push_rule(declared_params(include_missing: false))
present push_rule, with: Entities::ProjectPushRule
end
end
......
......@@ -59,6 +59,16 @@ describe API::ProjectPushRule, 'ProjectPushRule', api: true do
end
end
it 'adds push rule to project with no file size' do
post api("/projects/#{project.id}/push_rule", user),
commit_message_regex: 'JIRA\-\d+'
expect(response).to have_http_status(201)
expect(json_response['project_id']).to eq(project.id)
expect(json_response['commit_message_regex']).to eq('JIRA\-\d+')
expect(json_response['max_file_size']).to eq(0)
end
it 'returns 400 if no parameter is given' do
post api("/projects/#{project.id}/push_rule", user)
......
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