diff options
Diffstat (limited to 'spec/graphql/mutations/todos/create_spec.rb')
-rw-r--r-- | spec/graphql/mutations/todos/create_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/graphql/mutations/todos/create_spec.rb b/spec/graphql/mutations/todos/create_spec.rb index bbb033e2f33..8c6dca98bad 100644 --- a/spec/graphql/mutations/todos/create_spec.rb +++ b/spec/graphql/mutations/todos/create_spec.rb @@ -10,12 +10,19 @@ RSpec.describe Mutations::Todos::Create do context 'when target does not support todos' do it 'raises error' do current_user = create(:user) - mutation = described_class.new(object: nil, context: { current_user: current_user }, field: nil) - target = create(:milestone) - expect { mutation.resolve(target_id: global_id_of(target)) } - .to raise_error(GraphQL::CoercionError) + ctx = { current_user: current_user } + input = { target_id: global_id_of(target).to_s } + mutation = graphql_mutation(described_class, input) + + response = GitlabSchema.execute(mutation.query, context: ctx, variables: mutation.variables).to_h + + expect(response).to include( + 'errors' => contain_exactly( + include('message' => /invalid value for targetId/) + ) + ) end end |