diff options
author | Mateusz Bajorski <ematib@gmail.com> | 2018-01-21 20:16:56 +0300 |
---|---|---|
committer | Mateusz Bajorski <ematib@gmail.com> | 2018-03-03 14:12:38 +0300 |
commit | a0adf87707e44fda83aca859b41ce18372a1c72b (patch) | |
tree | e22f584c448c5a1c6b4664f1f7efb175e24a7493 /spec/services/quick_actions | |
parent | 4f10cad9ffdc508dbcecd477e93921367a69477d (diff) |
Changed command name to copy_metadata and added MR support
Diffstat (limited to 'spec/services/quick_actions')
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index ebe0c7639a0..9a8240f9491 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -306,17 +306,17 @@ describe QuickActions::InterpretService do end end - shared_examples 'inherit command' do - it 'fetches issue and copies labels and milestone if content contains /inherit issue_reference' do - issue_father # populate the issue + shared_examples 'copy_metadata command' do + it 'fetches issue or merge request and copies labels and milestone if content contains /copy_metadata reference' do + issueable_father # populate the issue todo_label # populate this label inreview_label # populate this label _, updates = service.execute(content, issuable) expect(updates[:add_label_ids]).to match_array([inreview_label.id, todo_label.id]) - if issue_father.milestone - expect(updates[:milestone_id]).to eq(issue_father.milestone.id) + if issueable_father.milestone + expect(updates[:milestone_id]).to eq(issueable_father.milestone.id) else expect(updates).not_to have_key(:milestone_id) end @@ -774,49 +774,49 @@ describe QuickActions::InterpretService do let(:issuable) { issue } end - context '/inherit command' do + context '/copy_metadata command' do let!(:todo_label) { create(:label, project: project, title: 'To Do') } let!(:inreview_label) { create(:label, project: project, title: 'In Review') } - it_behaves_like 'inherit command' do - # Without milestone assignment - let(:issue_father) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) } - - let(:content) { "/inherit #{issue_father.to_reference}" } + it_behaves_like 'empty command' do + let(:content) { '/copy_metadata' } let(:issuable) { issue } end - it_behaves_like 'inherit command' do - # With milestone assignment - let(:issue_father) { create(:labeled_issue, project: project, labels: [todo_label, inreview_label], milestone: milestone) } + it_behaves_like 'copy_metadata command' do + let(:issueable_father) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) } - let(:content) { "/inherit #{issue_father.to_reference(project)}" } + let(:content) { "/copy_metadata #{issueable_father.to_reference}" } let(:issuable) { issue } end - it_behaves_like 'empty command' do - let(:content) { '/inherit' } - let(:issuable) { issue } + context 'when the parent issueable has a milestone' do + it_behaves_like 'copy_metadata command' do + let(:issueable_father) { create(:labeled_issue, project: project, labels: [todo_label, inreview_label], milestone: milestone) } + + let(:content) { "/copy_metadata #{issueable_father.to_reference(project)}" } + let(:issuable) { issue } + end end context 'cross project references' do it_behaves_like 'empty command' do let(:other_project) { create(:project, :public) } - let(:issue_father) { create(:labeled_issue, project: other_project, labels: [todo_label, inreview_label]) } - let(:content) { "/inherit #{issue_father.to_reference(project)}" } + let(:issueable_father) { create(:labeled_issue, project: other_project, labels: [todo_label, inreview_label]) } + let(:content) { "/copy_metadata #{issueable_father.to_reference(project)}" } let(:issuable) { issue } end it_behaves_like 'empty command' do - let(:content) { "/inherit imaginary#1234" } + let(:content) { "/copy_metadata imaginary#1234" } let(:issuable) { issue } end it_behaves_like 'empty command' do let(:other_project) { create(:project, :private) } - let(:issue_father) { create(:issue, project: other_project) } + let(:issueable_father) { create(:issue, project: other_project) } - let(:content) { "/inherit #{issue_father.to_reference(project)}" } + let(:content) { "/copy_metadata #{issueable_father.to_reference(project)}" } let(:issuable) { issue } end end |