diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-09 12:08:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-09 12:08:04 +0300 |
commit | 2e2db606cc7547b445a11c367d8db6f5feb42443 (patch) | |
tree | 58a4d9c8ea1e78aaea796a525ef79c037f3e0e51 /spec | |
parent | c789d0002c97a00e262be992adfcc0d26b72910e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
9 files changed, 677 insertions, 1 deletions
diff --git a/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js b/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js index a8486809cdc..9c254f43504 100644 --- a/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js +++ b/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js @@ -6,6 +6,8 @@ import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import AdminNewRunnerApp from '~/ci/runner/admin_new_runner/admin_new_runner_app.vue'; import RunnerInstructionsModal from '~/vue_shared/components/runner_instructions/runner_instructions_modal.vue'; +import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; +import { DEFAULT_PLATFORM } from '~/ci/runner/constants'; const mockLegacyRegistrationToken = 'LEGACY_REGISTRATION_TOKEN'; @@ -16,6 +18,7 @@ describe('AdminNewRunnerApp', () => { const findLegacyInstructionsLink = () => wrapper.findByTestId('legacy-instructions-link'); const findRunnerInstructionsModal = () => wrapper.findComponent(RunnerInstructionsModal); + const findRunnerPlatformsRadioGroup = () => wrapper.findComponent(RunnerPlatformsRadioGroup); const createComponent = ({ props = {}, mountFn = shallowMountExtended, ...options } = {}) => { wrapper = mountFn(AdminNewRunnerApp, { @@ -50,4 +53,12 @@ describe('AdminNewRunnerApp', () => { expect(findRunnerInstructionsModal().props('modalId')).toBe(modalId); }); }); + + describe('New runner form fields', () => { + describe('Platform', () => { + it('shows the platforms radio group', () => { + expect(findRunnerPlatformsRadioGroup().props('value')).toBe(DEFAULT_PLATFORM); + }); + }); + }); }); diff --git a/spec/frontend/ci/runner/components/runner_platforms_radio_group_spec.js b/spec/frontend/ci/runner/components/runner_platforms_radio_group_spec.js new file mode 100644 index 00000000000..12c9afe9758 --- /dev/null +++ b/spec/frontend/ci/runner/components/runner_platforms_radio_group_spec.js @@ -0,0 +1,96 @@ +import { nextTick } from 'vue'; +import { GlFormRadioGroup, GlIcon, GlLink } from '@gitlab/ui'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import RunnerPlatformsRadio from '~/ci/runner/components/runner_platforms_radio.vue'; +import { + LINUX_PLATFORM, + MACOS_PLATFORM, + WINDOWS_PLATFORM, + AWS_PLATFORM, + DOCKER_HELP_URL, + KUBERNETES_HELP_URL, +} from '~/ci/runner/constants'; + +import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; + +const mockProvide = { + awsImgPath: 'awsLogo.svg', + dockerImgPath: 'dockerLogo.svg', + kubernetesImgPath: 'kubernetesLogo.svg', +}; + +describe('RunnerPlatformsRadioGroup', () => { + let wrapper; + + const findFormRadioGroup = () => wrapper.findComponent(GlFormRadioGroup); + const findFormRadios = () => wrapper.findAllComponents(RunnerPlatformsRadio).wrappers; + const findFormRadioByText = (text) => + findFormRadios() + .filter((w) => w.text() === text) + .at(0); + + const createComponent = ({ props = {}, mountFn = shallowMountExtended, ...options } = {}) => { + wrapper = mountFn(RunnerPlatformsRadioGroup, { + propsData: { + value: null, + ...props, + }, + provide: mockProvide, + ...options, + }); + }; + + beforeEach(() => { + createComponent(); + }); + + it('contains expected options with images', () => { + const labels = findFormRadios().map((w) => [w.text(), w.props('image')]); + + expect(labels).toEqual([ + ['Linux', null], + ['macOS', null], + ['Windows', null], + ['AWS', mockProvide.awsImgPath], + ['Docker', mockProvide.dockerImgPath], + ['Kubernetes', mockProvide.kubernetesImgPath], + ]); + }); + + it('allows users to use radio group', async () => { + findFormRadioGroup().vm.$emit('input', MACOS_PLATFORM); + await nextTick(); + + expect(wrapper.emitted('input')[0]).toEqual([MACOS_PLATFORM]); + }); + + it.each` + text | value + ${'Linux'} | ${LINUX_PLATFORM} + ${'macOS'} | ${MACOS_PLATFORM} + ${'Windows'} | ${WINDOWS_PLATFORM} + ${'AWS'} | ${AWS_PLATFORM} + `('user can select "$text"', async ({ text, value }) => { + const radio = findFormRadioByText(text); + expect(radio.props('value')).toBe(value); + + radio.vm.$emit('input', value); + await nextTick(); + + expect(wrapper.emitted('input')[0]).toEqual([value]); + }); + + it.each` + text | href + ${'Docker'} | ${DOCKER_HELP_URL} + ${'Kubernetes'} | ${KUBERNETES_HELP_URL} + `('provides link to "$text" docs', async ({ text, href }) => { + const radio = findFormRadioByText(text); + + expect(radio.findComponent(GlLink).attributes()).toEqual({ + href, + target: '_blank', + }); + expect(radio.findComponent(GlIcon).props('name')).toBe('external-link'); + }); +}); diff --git a/spec/frontend/ci/runner/components/runner_platforms_radio_spec.js b/spec/frontend/ci/runner/components/runner_platforms_radio_spec.js new file mode 100644 index 00000000000..fb81edd1ae2 --- /dev/null +++ b/spec/frontend/ci/runner/components/runner_platforms_radio_spec.js @@ -0,0 +1,154 @@ +import { GlFormRadio } from '@gitlab/ui'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; + +import RunnerPlatformsRadio from '~/ci/runner/components/runner_platforms_radio.vue'; + +const mockImg = 'mock.svg'; +const mockValue = 'value'; +const mockValue2 = 'value2'; +const mockSlot = '<div>a</div>'; + +describe('RunnerPlatformsRadio', () => { + let wrapper; + + const findDiv = () => wrapper.find('div'); + const findImg = () => wrapper.find('img'); + const findFormRadio = () => wrapper.findComponent(GlFormRadio); + + const createComponent = ({ props = {}, mountFn = shallowMountExtended, ...options } = {}) => { + wrapper = mountFn(RunnerPlatformsRadio, { + propsData: { + image: mockImg, + value: mockValue, + ...props, + }, + ...options, + }); + }; + + describe('when its selectable', () => { + beforeEach(() => { + createComponent({ + props: { value: mockValue }, + }); + }); + + it('shows the item is clickable', () => { + expect(wrapper.classes('gl-cursor-pointer')).toBe(true); + }); + + it('shows radio option', () => { + expect(findFormRadio().attributes('value')).toBe(mockValue); + }); + + it('emits when item is clicked', async () => { + findDiv().trigger('click'); + + expect(wrapper.emitted('input')).toEqual([[mockValue]]); + }); + + it.each(['input', 'change'])('emits radio "%s" event', (event) => { + findFormRadio().vm.$emit(event, mockValue2); + + expect(wrapper.emitted(event)).toEqual([[mockValue2]]); + }); + + it('shows image', () => { + expect(findImg().attributes()).toMatchObject({ + src: mockImg, + 'aria-hidden': 'true', + }); + }); + + it('shows slot', () => { + createComponent({ + slots: { + default: mockSlot, + }, + }); + + expect(wrapper.html()).toContain(mockSlot); + }); + + describe('with no image', () => { + beforeEach(() => { + createComponent({ + props: { value: mockValue, image: null }, + }); + }); + + it('shows no image', () => { + expect(findImg().exists()).toBe(false); + }); + }); + }); + + describe('when its not selectable', () => { + beforeEach(() => { + createComponent({ + props: { value: null }, + }); + }); + + it('shows the item is clickable', () => { + expect(wrapper.classes('gl-cursor-pointer')).toBe(false); + }); + + it('does not emit when item is clicked', async () => { + findDiv().trigger('click'); + + expect(wrapper.emitted('input')).toBe(undefined); + }); + + it('does not show a radio option', () => { + expect(findFormRadio().exists()).toBe(false); + }); + + it('shows image', () => { + expect(findImg().attributes()).toMatchObject({ + src: mockImg, + 'aria-hidden': 'true', + }); + }); + + it('shows slot', () => { + createComponent({ + slots: { + default: mockSlot, + }, + }); + + expect(wrapper.html()).toContain(mockSlot); + }); + + describe('with no image', () => { + beforeEach(() => { + createComponent({ + props: { value: null, image: null }, + }); + }); + + it('shows no image', () => { + expect(findImg().exists()).toBe(false); + }); + }); + }); + + describe('when selected', () => { + beforeEach(() => { + createComponent({ + props: { checked: mockValue }, + }); + }); + + it('highlights the item', () => { + expect(wrapper.classes('gl-bg-blue-50')).toBe(true); + expect(wrapper.classes('gl-border-blue-500')).toBe(true); + }); + + it('shows radio option as selected', () => { + expect(findFormRadio().attributes('value')).toBe(mockValue); + expect(findFormRadio().props('checked')).toBe(mockValue); + }); + }); +}); diff --git a/spec/migrations/remove_invalid_deploy_access_level_spec.rb b/spec/migrations/remove_invalid_deploy_access_level_spec.rb new file mode 100644 index 00000000000..cc0f5679dda --- /dev/null +++ b/spec/migrations/remove_invalid_deploy_access_level_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'spec_helper' + +require_migration! + +RSpec.describe RemoveInvalidDeployAccessLevel, :migration, feature_category: :continuous_integration do + let(:users) { table(:users) } + let(:groups) { table(:namespaces) } + let(:protected_environments) { table(:protected_environments) } + let(:deploy_access_levels) { table(:protected_environment_deploy_access_levels) } + + let(:user) { users.create!(email: 'email@email.com', name: 'foo', username: 'foo', projects_limit: 0) } + let(:group) { groups.create!(name: 'test-group', path: 'test-group') } + let(:pe) do + protected_environments.create!(name: 'test-pe', group_id: group.id) + end + + let!(:invalid_access_level) do + deploy_access_levels.create!( + access_level: 40, + user_id: user.id, + group_id: group.id, + protected_environment_id: pe.id) + end + + let!(:group_access_level) do + deploy_access_levels.create!( + group_id: group.id, + protected_environment_id: pe.id) + end + + let!(:user_access_level) do + deploy_access_levels.create!( + user_id: user.id, + protected_environment_id: pe.id) + end + + it 'removes invalid access_level entries' do + expect { migrate! }.to change { + deploy_access_levels.where( + protected_environment_id: pe.id, + access_level: nil).count + }.from(2).to(3) + + expect(invalid_access_level.reload.access_level).to be_nil + end +end diff --git a/spec/models/work_items/type_spec.rb b/spec/models/work_items/type_spec.rb index cf2e5d25756..65c6b22f5c2 100644 --- a/spec/models/work_items/type_spec.rb +++ b/spec/models/work_items/type_spec.rb @@ -146,4 +146,22 @@ RSpec.describe WorkItems::Type do it { is_expected.to be_falsey } end end + + describe '#default_issue?' do + context 'when work item type is default Issue' do + let(:work_item_type) { build(:work_item_type, name: described_class::TYPE_NAMES[:issue]) } + + it 'returns true' do + expect(work_item_type.default_issue?).to be(true) + end + end + + context 'when work item type is not Issue' do + let(:work_item_type) { build(:work_item_type) } + + it 'returns false' do + expect(work_item_type.default_issue?).to be(false) + end + end + end end diff --git a/spec/requests/api/graphql/mutations/work_items/update_spec.rb b/spec/requests/api/graphql/mutations/work_items/update_spec.rb index b33a394d023..271c2b917ad 100644 --- a/spec/requests/api/graphql/mutations/work_items/update_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/update_spec.rb @@ -127,7 +127,9 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do let(:fields) do <<~FIELDS workItem { + title description + state widgets { type ... on WorkItemWidgetDescription { @@ -179,6 +181,9 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do nodes { id } } } + ... on WorkItemWidgetDescription { + description + } } } errors @@ -201,6 +206,12 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do let(:expected_labels) { [] } it_behaves_like 'mutation updating work item labels' + + context 'with quick action' do + let(:input) { { 'descriptionWidget' => { 'description' => "/remove_label ~\"#{existing_label.name}\"" } } } + + it_behaves_like 'mutation updating work item labels' + end end context 'when only adding labels' do @@ -208,6 +219,14 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do let(:expected_labels) { [label1, label2, existing_label] } it_behaves_like 'mutation updating work item labels' + + context 'with quick action' do + let(:input) do + { 'descriptionWidget' => { 'description' => "/labels ~\"#{label1.name}\" ~\"#{label2.name}\"" } } + end + + it_behaves_like 'mutation updating work item labels' + end end context 'when adding and removing labels' do @@ -216,10 +235,46 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do let(:expected_labels) { [label1, label2] } it_behaves_like 'mutation updating work item labels' + + context 'with quick action' do + let(:input) do + { 'descriptionWidget' => { 'description' => + "/label ~\"#{label1.name}\" ~\"#{label2.name}\"\n/remove_label ~\"#{existing_label.name}\"" } } + end + + it_behaves_like 'mutation updating work item labels' + end + end + + context 'when the work item type does not support labels widget' do + let_it_be(:work_item) { create(:work_item, :task, project: project) } + + let(:input) { { 'descriptionWidget' => { 'description' => "Updating labels.\n/labels ~\"#{label1.name}\"" } } } + + before do + stub_const('::WorkItems::Type::WIDGETS_FOR_TYPE', { task: [::WorkItems::Widgets::Description] }) + end + + it 'ignores the quick action' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.not_to change(work_item.labels, :count) + + expect(work_item.labels).to be_empty + expect(mutation_response['workItem']['widgets']).to include( + 'description' => "Updating labels.", + 'type' => 'DESCRIPTION' + ) + expect(mutation_response['workItem']['widgets']).not_to include( + 'labels', + 'type' => 'LABELS' + ) + end end end - context 'with due and start date widget input' do + context 'with due and start date widget input', :freeze_time do let(:start_date) { Date.today } let(:due_date) { 1.week.from_now.to_date } let(:fields) do @@ -231,6 +286,9 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do startDate dueDate } + ... on WorkItemWidgetDescription { + description + } } } errors @@ -259,6 +317,80 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do ) end + context 'when using quick action' do + let(:due_date) { Date.today } + + context 'when removing due date' do + let(:input) { { 'descriptionWidget' => { 'description' => "/remove_due_date" } } } + + before do + work_item.update!(due_date: due_date) + end + + it 'updates start and due date' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.to not_change(work_item, :start_date).and( + change(work_item, :due_date).from(due_date).to(nil) + ) + + expect(response).to have_gitlab_http_status(:success) + expect(mutation_response['workItem']['widgets']).to include({ + 'startDate' => nil, + 'dueDate' => nil, + 'type' => 'START_AND_DUE_DATE' + }) + end + end + + context 'when setting due date' do + let(:input) { { 'descriptionWidget' => { 'description' => "/due today" } } } + + it 'updates due date' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.to not_change(work_item, :start_date).and( + change(work_item, :due_date).from(nil).to(due_date) + ) + + expect(response).to have_gitlab_http_status(:success) + expect(mutation_response['workItem']['widgets']).to include({ + 'startDate' => nil, + 'dueDate' => Date.today.to_s, + 'type' => 'START_AND_DUE_DATE' + }) + end + end + + context 'when the work item type does not support start and due date widget' do + let_it_be(:work_item) { create(:work_item, :task, project: project) } + + let(:input) { { 'descriptionWidget' => { 'description' => "Updating due date.\n/due today" } } } + + before do + stub_const('::WorkItems::Type::WIDGETS_FOR_TYPE', { task: [::WorkItems::Widgets::Description] }) + end + + it 'ignores the quick action' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.not_to change(work_item, :due_date) + + expect(mutation_response['workItem']['widgets']).to include( + 'description' => "Updating due date.", + 'type' => 'DESCRIPTION' + ) + expect(mutation_response['workItem']['widgets']).not_to include({ + 'dueDate' => nil, + 'type' => 'START_AND_DUE_DATE' + }) + end + end + end + context 'when provided input is invalid' do let(:due_date) { 1.week.ago.to_date } @@ -516,6 +648,9 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do } } } + ... on WorkItemWidgetDescription { + description + } } } errors @@ -544,6 +679,80 @@ RSpec.describe 'Update a work item', feature_category: :team_planning do } ) end + + context 'when using quick action' do + context 'when assigning a user' do + let(:input) { { 'descriptionWidget' => { 'description' => "/assign @#{developer.username}" } } } + + it 'updates the work item assignee' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.to change(work_item, :assignee_ids).from([]).to([developer.id]) + + expect(response).to have_gitlab_http_status(:success) + expect(mutation_response['workItem']['widgets']).to include( + { + 'type' => 'ASSIGNEES', + 'assignees' => { + 'nodes' => [ + { 'id' => developer.to_global_id.to_s, 'username' => developer.username } + ] + } + } + ) + end + end + + context 'when unassigning a user' do + let(:input) { { 'descriptionWidget' => { 'description' => "/unassign @#{developer.username}" } } } + + before do + work_item.update!(assignee_ids: [developer.id]) + end + + it 'updates the work item assignee' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.to change(work_item, :assignee_ids).from([developer.id]).to([]) + + expect(response).to have_gitlab_http_status(:success) + expect(mutation_response['workItem']['widgets']).to include( + 'type' => 'ASSIGNEES', + 'assignees' => { + 'nodes' => [] + } + ) + end + end + end + + context 'when the work item type does not support the assignees widget' do + let_it_be(:work_item) { create(:work_item, :task, project: project) } + + let(:input) do + { 'descriptionWidget' => { 'description' => "Updating assignee.\n/assign @#{developer.username}" } } + end + + before do + stub_const('::WorkItems::Type::WIDGETS_FOR_TYPE', { task: [::WorkItems::Widgets::Description] }) + end + + it 'ignores the quick action' do + expect do + post_graphql_mutation(mutation, current_user: current_user) + work_item.reload + end.not_to change(work_item, :assignee_ids) + + expect(mutation_response['workItem']['widgets']).to include({ + 'description' => "Updating assignee.", + 'type' => 'DESCRIPTION' + } + ) + expect(mutation_response['workItem']['widgets']).not_to include({ 'type' => 'ASSIGNEES' }) + end + end end context 'when updating milestone' do diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 7ab2046b6be..abb59ad7ebf 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -565,6 +565,36 @@ RSpec.describe Issues::CreateService do end context 'Quick actions' do + context 'as work item' do + let(:opts) do + { + title: "My work item", + work_item_type: work_item_type, + description: "/shrug" + } + end + + context 'when work item type is not the default Issue' do + let(:work_item_type) { create(:work_item_type, namespace: project.namespace) } + + it 'saves the work item without applying the quick action' do + expect(result).to be_success + expect(issue).to be_persisted + expect(issue.description).to eq("/shrug") + end + end + + context 'when work item type is the default Issue' do + let(:work_item_type) { WorkItems::Type.default_by_type(:issue) } + + it 'saves the work item and applies the quick action' do + expect(result).to be_success + expect(issue).to be_persisted + expect(issue.description).to eq(" ¯\\_(ツ)_/¯") + end + end + end + context 'with assignee, milestone, and contact in params and command' do let_it_be(:contact) { create(:contact, group: group) } diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 7fd09cc2779..f1859b2208c 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -1475,5 +1475,31 @@ RSpec.describe Issues::UpdateService, :mailer do let(:existing_issue) { create(:issue, project: project) } let(:issuable) { described_class.new(project: project, current_user: user, params: params).execute(existing_issue) } end + + context 'with quick actions' do + context 'as work item' do + let(:opts) { { description: "/shrug" } } + + context 'when work item type is not the default Issue' do + let(:issue) { create(:work_item, :task, description: "") } + + it 'does not apply the quick action' do + expect do + update_issue(opts) + end.to change(issue, :description).to("/shrug") + end + end + + context 'when work item type is the default Issue' do + let(:issue) { create(:work_item, :issue, description: "") } + + it 'does not apply the quick action' do + expect do + update_issue(opts) + end.to change(issue, :description).to(" ¯\\_(ツ)_/¯") + end + end + end + end end end diff --git a/spec/support/shared_examples/graphql/mutations/work_items/update_description_widget_shared_examples.rb b/spec/support/shared_examples/graphql/mutations/work_items/update_description_widget_shared_examples.rb index f672ec7f5ac..2ec48aa405b 100644 --- a/spec/support/shared_examples/graphql/mutations/work_items/update_description_widget_shared_examples.rb +++ b/spec/support/shared_examples/graphql/mutations/work_items/update_description_widget_shared_examples.rb @@ -31,4 +31,88 @@ RSpec.shared_examples 'update work item description widget' do expect(mutation_response['errors']).to match_array(['Description error message']) end end + + context 'when the edited description includes quick action(s)' do + let(:input) { { 'descriptionWidget' => { 'description' => new_description } } } + + shared_examples 'quick action is applied' do + before do + post_graphql_mutation(mutation, current_user: current_user) + end + + it 'applies the quick action(s)' do + expect(response).to have_gitlab_http_status(:success) + expect(mutation_response['workItem']).to include(expected_response) + end + end + + context 'with /title quick action' do + it_behaves_like 'quick action is applied' do + let(:new_description) { "updated description\n/title updated title" } + let(:filtered_description) { "updated description" } + + let(:expected_response) do + { + 'title' => 'updated title', + 'widgets' => include({ + 'description' => filtered_description, + 'type' => 'DESCRIPTION' + }) + } + end + end + end + + context 'with /shrug, /tableflip and /cc quick action' do + it_behaves_like 'quick action is applied' do + let(:new_description) { "/tableflip updated description\n/shrug\n/cc @#{developer.username}" } + # note: \cc performs no action since 15.0 + let(:filtered_description) { "updated description (╯°□°)╯︵ ┻━┻\n ¯\\_(ツ)_/¯\n/cc @#{developer.username}" } + let(:expected_response) do + { + 'widgets' => include({ + 'description' => filtered_description, + 'type' => 'DESCRIPTION' + }) + } + end + end + end + + context 'with /close' do + it_behaves_like 'quick action is applied' do + let(:new_description) { "Resolved work item.\n/close" } + let(:filtered_description) { "Resolved work item." } + let(:expected_response) do + { + 'state' => 'CLOSED', + 'widgets' => include({ + 'description' => filtered_description, + 'type' => 'DESCRIPTION' + }) + } + end + end + end + + context 'with /reopen' do + before do + work_item.close! + end + + it_behaves_like 'quick action is applied' do + let(:new_description) { "Re-opening this work item.\n/reopen" } + let(:filtered_description) { "Re-opening this work item." } + let(:expected_response) do + { + 'state' => 'OPEN', + 'widgets' => include({ + 'description' => filtered_description, + 'type' => 'DESCRIPTION' + }) + } + end + end + end + end end |