diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-01-26 18:08:20 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-02 11:25:44 -0200 |
commit | a2bbf004779db402e67a918db893c166502f5050 (patch) | |
tree | 1ad63ff44c8071630e7aff93ebddb0c644b877af /spec/requests | |
parent | 62cad887ea695d40afee894089f894ee398cf98a (diff) | |
download | gitlab-ce-a2bbf004779db402e67a918db893c166502f5050.tar.gz |
Refactor spam filtering on issues API
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/issues_spec.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 2e50344c149..dcf1b394a3f 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -249,14 +249,19 @@ describe API::API, api: true do end end - it "should create a new project issue" do - post api("/projects/#{project.id}/issues", user), - title: 'new issue', labels: 'label, label2' + it "should not create a new project issue" do + expect { + post api("/projects/#{project.id}/issues", user), + title: 'new issue', description: 'content here', labels: 'label, label2' + }.not_to change(Issue, :count) + expect(response.status).to eq(400) expect(json_response['message']).to eq({ "error" => "Spam detected" }) + spam_logs = SpamLog.all expect(spam_logs.count).to eq(1) expect(spam_logs[0].title).to eq('new issue') + expect(spam_logs[0].description).to eq('content here') expect(spam_logs[0].user).to eq(user) expect(spam_logs[0].noteable_type).to eq('Issue') expect(spam_logs[0].project_id).to eq(project.id) |