summaryrefslogtreecommitdiff
path: root/spec/graphql/mutations/work_items/update_widgets_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/graphql/mutations/work_items/update_widgets_spec.rb
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
downloadgitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/graphql/mutations/work_items/update_widgets_spec.rb')
-rw-r--r--spec/graphql/mutations/work_items/update_widgets_spec.rb58
1 files changed, 0 insertions, 58 deletions
diff --git a/spec/graphql/mutations/work_items/update_widgets_spec.rb b/spec/graphql/mutations/work_items/update_widgets_spec.rb
deleted file mode 100644
index 2e54b81b5c7..00000000000
--- a/spec/graphql/mutations/work_items/update_widgets_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Mutations::WorkItems::UpdateWidgets do
- include GraphqlHelpers
-
- let_it_be(:project) { create(:project) }
- let_it_be(:developer) { create(:user).tap { |user| project.add_developer(user) } }
-
- let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
-
- describe '#resolve' do
- before do
- stub_spam_services
- end
-
- context 'when no work item matches the given id' do
- let(:current_user) { developer }
- let(:gid) { global_id_of(id: non_existing_record_id, model_name: WorkItem.name) }
-
- it 'raises an error' do
- expect { mutation.resolve(id: gid, resolve: true) }.to raise_error(
- Gitlab::Graphql::Errors::ResourceNotAvailable,
- Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
- )
- end
- end
-
- context 'when user can access the requested work item', :aggregate_failures do
- let(:current_user) { developer }
- let(:args) { {} }
-
- let_it_be(:work_item) { create(:work_item, project: project) }
-
- subject { mutation.resolve(id: work_item.to_global_id, **args) }
-
- context 'when `:work_items` is disabled for a project' do
- let_it_be(:project2) { create(:project) }
-
- it 'returns an error' do
- stub_feature_flags(work_items: project2) # only enable `work_item` for project2
-
- expect(subject[:errors]).to contain_exactly('`work_items` feature flag disabled for this project')
- end
- end
-
- context 'when resolved with an input for description widget' do
- let(:args) { { description_widget: { description: "updated description" } } }
-
- it 'returns the updated work item' do
- expect(subject[:work_item].description).to eq("updated description")
- expect(subject[:errors]).to be_empty
- end
- end
- end
- end
-end