diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
commit | 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch) | |
tree | 3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /spec/support/shared_contexts/quick_actions | |
parent | 9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'spec/support/shared_contexts/quick_actions')
-rw-r--r-- | spec/support/shared_contexts/quick_actions/work_items_type_change_shared_context.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/quick_actions/work_items_type_change_shared_context.rb b/spec/support/shared_contexts/quick_actions/work_items_type_change_shared_context.rb new file mode 100644 index 00000000000..fc51af899a0 --- /dev/null +++ b/spec/support/shared_contexts/quick_actions/work_items_type_change_shared_context.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +RSpec.shared_context 'with work item change type context' do + let_it_be(:project) { create(:project, :private) } + let_it_be(:work_item) { create(:work_item, project: project) } + let(:new_type) { 'Task' } + let(:with_access) { true } + + before do + allow(Ability).to receive(:allowed?).and_call_original + allow(Ability).to receive(:allowed?).with(current_user, :"create_#{new_type.downcase}", work_item) + .and_return(with_access) + end + + shared_examples 'quick command error' do |error_reason, action = 'convert'| + let(:error) { format("Failed to %{action} this work item: %{reason}.", action: action, reason: error_reason) } + + it 'returns error' do + _, updates, message = service.execute(command, work_item) + + expect(message).to eq(error) + expect(updates).to eq({}) + end + end +end |