diff options
Diffstat (limited to 'spec/support/services/issuable_create_service_slash_commands_shared_examples.rb')
-rw-r--r-- | spec/support/services/issuable_create_service_slash_commands_shared_examples.rb | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb b/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb deleted file mode 100644 index 3d45fe06134..00000000000 --- a/spec/support/services/issuable_create_service_slash_commands_shared_examples.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -# Specifications for behavior common to all objects with executable attributes. -# It can take a `default_params`. - -RSpec.shared_examples 'new issuable record that supports quick actions' do - let!(:project) { create(:project, :repository) } - let(:user) { create(:user).tap { |u| project.add_maintainer(u) } } - let(:assignee) { create(:user) } - let!(:milestone) { create(:milestone, project: project) } - let!(:labels) { create_list(:label, 3, project: project) } - let(:base_params) { { title: 'My issuable title' } } - let(:params) { base_params.merge(defined?(default_params) ? default_params : {}).merge(example_params) } - let(:issuable) { described_class.new(project, user, params).execute } - - before do - project.add_maintainer(assignee) - end - - context 'with labels in command only' do - let(:example_params) do - { - description: "/label ~#{labels.first.name} ~#{labels.second.name}\n/unlabel ~#{labels.third.name}" - } - end - - it 'attaches labels to issuable' do - expect(issuable).to be_persisted - expect(issuable.label_ids).to match_array([labels.first.id, labels.second.id]) - end - end - - context 'with labels in params and command' do - let(:example_params) do - { - label_ids: [labels.second.id], - description: "/label ~#{labels.first.name}\n/unlabel ~#{labels.third.name}" - } - end - - it 'attaches all labels to issuable' do - expect(issuable).to be_persisted - expect(issuable.label_ids).to match_array([labels.first.id, labels.second.id]) - end - end - - context 'with assignee and milestone in command only' do - let(:example_params) do - { - description: %(/assign @#{assignee.username}\n/milestone %"#{milestone.name}") - } - end - - it 'assigns and sets milestone to issuable' do - expect(issuable).to be_persisted - expect(issuable.assignees).to eq([assignee]) - expect(issuable.milestone).to eq(milestone) - end - end - - describe '/close' do - let(:example_params) do - { - description: '/close' - } - end - - it 'returns an open issue' do - expect(issuable).to be_persisted - expect(issuable).to be_open - end - end -end |