diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/services/issuable/bulk_update_service_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/services/issuable/bulk_update_service_spec.rb')
-rw-r--r-- | spec/services/issuable/bulk_update_service_spec.rb | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb index f2bc4f717af..79543fe9f5d 100644 --- a/spec/services/issuable/bulk_update_service_spec.rb +++ b/spec/services/issuable/bulk_update_service_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe Issuable::BulkUpdateService do - let(:user) { create(:user) } - let(:project) { create(:project, :repository, namespace: user.namespace) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository, namespace: user.namespace) } def bulk_update(issuables, extra_params = {}) bulk_update_params = extra_params @@ -31,6 +31,23 @@ RSpec.describe Issuable::BulkUpdateService do end end + shared_examples 'updates iterations' do + it 'succeeds' do + result = bulk_update(issuables, sprint_id: iteration.id) + + expect(result.success?).to be_truthy + expect(result.payload[:count]).to eq(issuables.count) + end + + it 'updates the issuables iteration' do + bulk_update(issuables, sprint_id: iteration.id) + + issuables.each do |issuable| + expect(issuable.reload.iteration).to eq(iteration) + end + end + end + shared_examples 'updating labels' do def create_issue_with_labels(labels) create(:labeled_issue, project: project, labels: labels) @@ -233,6 +250,21 @@ RSpec.describe Issuable::BulkUpdateService do it_behaves_like 'updates milestones' end + describe 'updating iterations' do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } + let_it_be(:issuables) { [create(:issue, project: project)] } + let_it_be(:iteration) { create(:iteration, group: group) } + + let(:parent) { project } + + before do + group.add_reporter(user) + end + + it_behaves_like 'updates iterations' + end + describe 'updating labels' do let(:bug) { create(:label, project: project) } let(:regression) { create(:label, project: project) } @@ -283,7 +315,7 @@ RSpec.describe Issuable::BulkUpdateService do end context 'with issuables at a group level' do - let(:group) { create(:group) } + let_it_be(:group) { create(:group) } let(:parent) { group } before do @@ -315,6 +347,19 @@ RSpec.describe Issuable::BulkUpdateService do end end + describe 'updating iterations' do + let_it_be(:iteration) { create(:iteration, group: group) } + let_it_be(:project) { create(:project, :repository, group: group) } + + context 'when issues' do + let_it_be(:issue1) { create(:issue, project: project) } + let_it_be(:issue2) { create(:issue, project: project) } + let_it_be(:issuables) { [issue1, issue2] } + + it_behaves_like 'updates iterations' + end + end + describe 'updating labels' do let(:project) { create(:project, :repository, group: group) } let(:bug) { create(:group_label, group: group) } |