summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-03-22 11:53:24 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-03-22 11:53:24 +0000
commit85ffd85a2bde09691784adb32395ad2c5a3ff909 (patch)
treea781997b91e5aa1dd770b63712ed21ed8ddfa042 /spec/controllers
parent78840333d7e1432fc6235b59e90040d0f9e43b41 (diff)
parentd730b69eb26ab5917b773a242c21f5967661d964 (diff)
downloadgitlab-ce-85ffd85a2bde09691784adb32395ad2c5a3ff909.tar.gz
Merge branch '29483-spam-check-only-title-and-description' into 'master'
Spam check only when Snippet / Issue "title" or "description" are changed Closes #29483 and #29645 See merge request !10104
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 57a921e3676..c467ab9fb8a 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -241,10 +241,27 @@ describe Projects::IssuesController do
expect(spam_logs.first.recaptcha_verified).to be_falsey
end
- it 'renders verify template' do
- update_spam_issue
+ context 'as HTML' do
+ it 'renders verify template' do
+ update_spam_issue
+
+ expect(response).to render_template(:verify)
+ end
+ end
+
+ context 'as JSON' do
+ before do
+ update_issue({ title: 'Spam Title', description: 'Spam lives here' }, format: :json)
+ end
+
+ it 'renders json errors' do
+ expect(json_response)
+ .to eql("errors" => ["Your issue has been recognized as spam. Please, change the content or solve the reCAPTCHA to proceed."])
+ end
- expect(response).to render_template(:verify)
+ it 'returns 422 status' do
+ expect(response).to have_http_status(422)
+ end
end
end