diff options
Diffstat (limited to 'spec/support/shared_examples/graphql/mutations/can_mutate_spammable_examples.rb')
-rw-r--r-- | spec/support/shared_examples/graphql/mutations/can_mutate_spammable_examples.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/support/shared_examples/graphql/mutations/can_mutate_spammable_examples.rb b/spec/support/shared_examples/graphql/mutations/can_mutate_spammable_examples.rb new file mode 100644 index 00000000000..d294f034d2e --- /dev/null +++ b/spec/support/shared_examples/graphql/mutations/can_mutate_spammable_examples.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.shared_examples 'a mutation which can mutate a spammable' do + describe "#additional_spam_params" do + it 'passes additional spam params to the service' do + args = [ + anything, + anything, + hash_including( + api: true, + request: instance_of(ActionDispatch::Request), + captcha_response: captcha_response, + spam_log_id: spam_log_id + ) + ] + expect(service).to receive(:new).with(*args).and_call_original + + subject + end + end + + describe "#with_spam_action_fields" do + it 'resolves with spam action fields' do + subject + + # NOTE: We do not need to assert on the specific values of spam action fields here, we only need + # to verify that #with_spam_action_fields was invoked and that the fields are present in the + # response. The specific behavior of #with_spam_action_fields is covered in the + # CanMutateSpammable unit tests. + expect(mutation_response.keys) + .to include('spam', 'spamLogId', 'needsCaptchaResponse', 'captchaSiteKey') + end + end +end |