diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/services/issues/update_service_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/services/issues/update_service_spec.rb')
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 80039049bc3..33ae2682d01 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe Issues::UpdateService, :mailer do - let(:user) { create(:user) } - let(:user2) { create(:user) } - let(:user3) { create(:user) } - let(:group) { create(:group, :public) } - let(:project) { create(:project, :repository, group: group) } - let(:label) { create(:label, project: project) } - let(:label2) { create(:label) } + let_it_be(:user) { create(:user) } + let_it_be(:user2) { create(:user) } + let_it_be(:user3) { create(:user) } + let_it_be(:group) { create(:group, :public) } + let_it_be(:project, reload: true) { create(:project, :repository, group: group) } + let_it_be(:label) { create(:label, project: project) } + let_it_be(:label2) { create(:label, project: project) } let(:issue) do create(:issue, title: 'Old title', @@ -19,7 +19,7 @@ describe Issues::UpdateService, :mailer do author: create(:user)) end - before do + before_all do project.add_maintainer(user) project.add_developer(user2) project.add_developer(user3) @@ -669,28 +669,24 @@ describe Issues::UpdateService, :mailer do context 'when add_label_ids and label_ids are passed' do let(:params) { { label_ids: [label.id], add_label_ids: [label3.id] } } - it 'ignores the label_ids parameter' do - expect(result.label_ids).not_to include(label.id) + before do + issue.update(labels: [label2]) end - it 'adds the passed labels' do - expect(result.label_ids).to include(label3.id) + it 'replaces the labels with the ones in label_ids and adds those in add_label_ids' do + expect(result.label_ids).to contain_exactly(label.id, label3.id) end end context 'when remove_label_ids and label_ids are passed' do - let(:params) { { label_ids: [], remove_label_ids: [label.id] } } + let(:params) { { label_ids: [label.id, label2.id, label3.id], remove_label_ids: [label.id] } } before do issue.update(labels: [label, label3]) end - it 'ignores the label_ids parameter' do - expect(result.label_ids).not_to be_empty - end - - it 'removes the passed labels' do - expect(result.label_ids).not_to include(label.id) + it 'replaces the labels with the ones in label_ids and removes those in remove_label_ids' do + expect(result.label_ids).to contain_exactly(label2.id, label3.id) end end |