diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/graphql/mutations/todos/create_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/graphql/mutations/todos/create_spec.rb')
-rw-r--r-- | spec/graphql/mutations/todos/create_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/graphql/mutations/todos/create_spec.rb b/spec/graphql/mutations/todos/create_spec.rb new file mode 100644 index 00000000000..bbb033e2f33 --- /dev/null +++ b/spec/graphql/mutations/todos/create_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Mutations::Todos::Create do + include GraphqlHelpers + include DesignManagementTestHelpers + + describe '#resolve' 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) + end + end + + context 'with issue as target' do + it_behaves_like 'create todo mutation' do + let_it_be(:target) { create(:issue) } + end + end + + context 'with merge request as target' do + it_behaves_like 'create todo mutation' do + let_it_be(:target) { create(:merge_request) } + end + end + + context 'with design as target' do + before do + enable_design_management + end + + it_behaves_like 'create todo mutation' do + let_it_be(:target) { create(:design) } + end + end + end +end |