diff options
Diffstat (limited to 'spec/graphql/mutations')
-rw-r--r-- | spec/graphql/mutations/base_mutation_spec.rb | 58 | ||||
-rw-r--r-- | spec/graphql/mutations/ci/runner/delete_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/mutations/ci/runner/update_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/mutations/merge_requests/update_spec.rb | 14 |
4 files changed, 2 insertions, 74 deletions
diff --git a/spec/graphql/mutations/base_mutation_spec.rb b/spec/graphql/mutations/base_mutation_spec.rb deleted file mode 100644 index a73d914f48f..00000000000 --- a/spec/graphql/mutations/base_mutation_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ::Mutations::BaseMutation, feature_category: :api do - include GraphqlHelpers - - describe 'argument nullability' do - let_it_be(:user) { create(:user) } - let_it_be(:context) { { current_user: user } } - - subject(:mutation) { mutation_class.new(object: nil, context: context, field: nil) } - - describe 'when using a mutation with correct argument declarations' do - context 'when argument is nullable and required' do - let(:mutation_class) do - Class.new(described_class) do - graphql_name 'BaseMutation' - argument :foo, GraphQL::Types::String, required: :nullable - end - end - - specify do - expect { subject.ready? }.to raise_error(ArgumentError, /must be provided: foo/) - end - - specify do - expect { subject.ready?(foo: nil) }.not_to raise_error - end - - specify do - expect { subject.ready?(foo: "bar") }.not_to raise_error - end - end - - context 'when argument is required and NOT nullable' do - let(:mutation_class) do - Class.new(described_class) do - graphql_name 'BaseMutation' - argument :foo, GraphQL::Types::String, required: true - end - end - - specify do - expect { subject.ready? }.to raise_error(ArgumentError, /must be provided/) - end - - specify do - expect { subject.ready?(foo: nil) }.to raise_error(ArgumentError, /must be provided/) - end - - specify do - expect { subject.ready?(foo: "bar") }.not_to raise_error - end - end - end - end -end diff --git a/spec/graphql/mutations/ci/runner/delete_spec.rb b/spec/graphql/mutations/ci/runner/delete_spec.rb index f19fa7c34a9..beff18e1dfd 100644 --- a/spec/graphql/mutations/ci/runner/delete_spec.rb +++ b/spec/graphql/mutations/ci/runner/delete_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Mutations::Ci::Runner::Delete, feature_category: :runner_fleet do let(:mutation_params) { {} } it 'raises an error' do - expect { subject }.to raise_error(ArgumentError, "Arguments must be provided: id") + expect { subject }.to raise_error(ArgumentError, "missing keyword: :id") end end diff --git a/spec/graphql/mutations/ci/runner/update_spec.rb b/spec/graphql/mutations/ci/runner/update_spec.rb index 02bb7ee2170..03bfd4d738b 100644 --- a/spec/graphql/mutations/ci/runner/update_spec.rb +++ b/spec/graphql/mutations/ci/runner/update_spec.rb @@ -42,7 +42,7 @@ RSpec.describe Mutations::Ci::Runner::Update, feature_category: :runner_fleet do let(:mutation_params) { {} } it 'raises an error' do - expect { response }.to raise_error(ArgumentError, "Arguments must be provided: id") + expect { response }.to raise_error(ArgumentError, "missing keyword: :id") end end diff --git a/spec/graphql/mutations/merge_requests/update_spec.rb b/spec/graphql/mutations/merge_requests/update_spec.rb index 6ced71c5f4c..c34ec939d12 100644 --- a/spec/graphql/mutations/merge_requests/update_spec.rb +++ b/spec/graphql/mutations/merge_requests/update_spec.rb @@ -153,20 +153,6 @@ RSpec.describe Mutations::MergeRequests::Update, feature_category: :team_plannin subject(:ready) { mutation.ready?(**arguments) } - context 'when required arguments are not provided' do - let(:arguments) { {} } - - it 'raises an argument error' do - expect { subject }.to raise_error(ArgumentError, 'Arguments must be provided: projectPath, iid') - end - end - - context 'when required arguments are provided' do - it 'returns true' do - expect(subject).to eq(true) - end - end - context 'when timeEstimate is provided' do let(:extra_args) { { time_estimate: time_estimate } } |