Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/mutations/todos')
-rw-r--r--spec/graphql/mutations/todos/create_spec.rb15
-rw-r--r--spec/graphql/mutations/todos/mark_done_spec.rb9
-rw-r--r--spec/graphql/mutations/todos/restore_many_spec.rb7
-rw-r--r--spec/graphql/mutations/todos/restore_spec.rb9
4 files changed, 11 insertions, 29 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
diff --git a/spec/graphql/mutations/todos/mark_done_spec.rb b/spec/graphql/mutations/todos/mark_done_spec.rb
index 9723ac8af42..51df2032cf1 100644
--- a/spec/graphql/mutations/todos/mark_done_spec.rb
+++ b/spec/graphql/mutations/todos/mark_done_spec.rb
@@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::MarkDone do
expect(todo2.reload.state).to eq('done')
expect(other_user_todo.reload.state).to eq('pending')
end
-
- it 'ignores invalid GIDs' do
- expect { mutation.resolve(id: author.to_global_id.to_s) }
- .to raise_error(::GraphQL::CoercionError)
-
- expect(todo1.reload.state).to eq('pending')
- expect(todo2.reload.state).to eq('done')
- expect(other_user_todo.reload.state).to eq('pending')
- end
end
def mark_done_mutation(todo)
diff --git a/spec/graphql/mutations/todos/restore_many_spec.rb b/spec/graphql/mutations/todos/restore_many_spec.rb
index dc10355ef22..d43f1c8a2e9 100644
--- a/spec/graphql/mutations/todos/restore_many_spec.rb
+++ b/spec/graphql/mutations/todos/restore_many_spec.rb
@@ -49,13 +49,6 @@ RSpec.describe Mutations::Todos::RestoreMany do
expect_states_were_not_changed
end
- it 'raises an error with invalid or non-Todo GIDs' do
- expect { mutation.resolve(ids: [author.to_global_id.to_s]) }
- .to raise_error(GraphQL::CoercionError)
-
- expect_states_were_not_changed
- end
-
it 'restores multiple todos' do
todo4 = create(:todo, user: current_user, author: author, state: :done)
diff --git a/spec/graphql/mutations/todos/restore_spec.rb b/spec/graphql/mutations/todos/restore_spec.rb
index 954bb3db668..fad9d6c08a6 100644
--- a/spec/graphql/mutations/todos/restore_spec.rb
+++ b/spec/graphql/mutations/todos/restore_spec.rb
@@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::Restore do
expect(todo2.reload.state).to eq('pending')
expect(other_user_todo.reload.state).to eq('done')
end
-
- it 'raises error for invalid GID' do
- expect { mutation.resolve(id: author.to_global_id.to_s) }
- .to raise_error(::GraphQL::CoercionError)
-
- expect(todo1.reload.state).to eq('done')
- expect(todo2.reload.state).to eq('pending')
- expect(other_user_todo.reload.state).to eq('done')
- end
end
def restore_mutation(todo)