diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb')
-rw-r--r-- | spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb b/spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb deleted file mode 100644 index 8678b23ad31..00000000000 --- a/spec/support/shared_examples/graphql/mutations/spammable_mutation_fields_examples.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.shared_examples 'spam flag is present' do - specify :aggregate_failures do - subject - - expect(mutation_response).to have_key('spam') - expect(mutation_response['spam']).to be_falsey - end -end - -RSpec.shared_examples 'can raise spam flag' do - it 'spam parameters are passed to the service' do - args = [anything, anything, hash_including(api: true, request: instance_of(ActionDispatch::Request))] - expect(service).to receive(:new).with(*args).and_call_original - - subject - end - - context 'when the snippet is detected as spam' do - it 'raises spam flag' do - allow_next_instance_of(service) do |instance| - allow(instance).to receive(:spam_check) do |snippet, user, _| - snippet.spam! - end - end - - subject - - expect(mutation_response['spam']).to be true - expect(mutation_response['errors']).to include("Your snippet has been recognized as spam and has been discarded.") - end - end - - context 'when :snippet_spam flag is disabled' do - before do - stub_feature_flags(snippet_spam: false) - end - - it 'request parameter is not passed to the service' do - expect(service).to receive(:new) - .with(anything, anything, hash_not_including(request: instance_of(ActionDispatch::Request))) - .and_call_original - - subject - end - end -end |