summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-04-05 08:19:15 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-04-05 08:19:15 +0000
commit7412ad2e3680b7f7a18d89dd8e30f01b28c19326 (patch)
tree46be39c3b60be74563354beeaec8753f87f11a5c /spec/services
parentb87820c162cfa38678dfe2b56c41b41253122b3e (diff)
parent7481fc5aa8e7d6cee3e03480a6b7dd7a7d19307e (diff)
downloadgitlab-ce-7412ad2e3680b7f7a18d89dd8e30f01b28c19326.tar.gz
Merge branch 'issue_44551' into 'master'
Fix 404 in group boards when moving issue between lists Closes #44551 See merge request gitlab-org/gitlab-ce!18064
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/boards/issues/move_service_spec.rb2
-rw-r--r--spec/services/issues/update_service_spec.rb31
2 files changed, 32 insertions, 1 deletions
diff --git a/spec/services/boards/issues/move_service_spec.rb b/spec/services/boards/issues/move_service_spec.rb
index 0a6b6d880d3..dd0ad5f11bd 100644
--- a/spec/services/boards/issues/move_service_spec.rb
+++ b/spec/services/boards/issues/move_service_spec.rb
@@ -48,7 +48,7 @@ describe Boards::Issues::MoveService do
parent.add_developer(user)
end
- it_behaves_like 'issues move service'
+ it_behaves_like 'issues move service', true
end
end
end
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index 41237dd7160..f95474208f3 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -97,6 +97,37 @@ describe Issues::UpdateService, :mailer do
expect(issue.relative_position).to be_between(issue1.relative_position, issue2.relative_position)
end
+ context 'when moving issue between issues from different projects' do
+ let(:group) { create(:group) }
+ let(:project_1) { create(:project, namespace: group) }
+ let(:project_2) { create(:project, namespace: group) }
+ let(:project_3) { create(:project, namespace: group) }
+
+ let(:issue_1) { create(:issue, project: project_1) }
+ let(:issue_2) { create(:issue, project: project_2) }
+ let(:issue_3) { create(:issue, project: project_3) }
+
+ before do
+ group.add_developer(user)
+ end
+
+ it 'sorts issues as specified by parameters' do
+ # Moving all issues to end here like the last example won't work since
+ # all projects only have the same issue count
+ # so their relative_position will be the same.
+ issue_1.move_to_end
+ issue_2.move_after(issue_1)
+ issue_3.move_after(issue_2)
+ [issue_1, issue_2, issue_3].map(&:save)
+
+ opts[:move_between_ids] = [issue_1.id, issue_2.id]
+ opts[:board_group_id] = group.id
+
+ described_class.new(issue_3.project, user, opts).execute(issue_3)
+ expect(issue_2.relative_position).to be_between(issue_1.relative_position, issue_2.relative_position)
+ end
+ end
+
context 'when current user cannot admin issues in the project' do
let(:guest) { create(:user) }
before do