summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-08-05 10:56:27 +0200
committerJames Lopez <james@jameslopez.es>2016-08-09 11:03:02 +0200
commitf8e854798032d71e3b3cb2bcf49cf104e5d0e611 (patch)
tree3dadab243be69662f8e41afbfb8fe98cc008c138 /spec
parent551ffc0a4d25a381e9f8f6a8d6f2793bb87f3145 (diff)
downloadgitlab-ce-f8e854798032d71e3b3cb2bcf49cf104e5d0e611.tar.gz
fix MR source project assignmentfix/import-mr-source
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/import_export/project.json6
-rw-r--r--spec/lib/gitlab/import_export/project_tree_restorer_spec.rb22
2 files changed, 25 insertions, 3 deletions
diff --git a/spec/lib/gitlab/import_export/project.json b/spec/lib/gitlab/import_export/project.json
index b5550ca1963..cbbf98dca94 100644
--- a/spec/lib/gitlab/import_export/project.json
+++ b/spec/lib/gitlab/import_export/project.json
@@ -2393,7 +2393,7 @@
"source_project_id": 5,
"author_id": 1,
"assignee_id": null,
- "title": "Cannot be automatically merged",
+ "title": "MR1",
"created_at": "2016-06-14T15:02:36.568Z",
"updated_at": "2016-06-14T15:02:56.815Z",
"state": "opened",
@@ -2827,10 +2827,10 @@
"id": 26,
"target_branch": "master",
"source_branch": "feature",
- "source_project_id": 5,
+ "source_project_id": 4,
"author_id": 1,
"assignee_id": null,
- "title": "Can be automatically merged",
+ "title": "MR2",
"created_at": "2016-06-14T15:02:36.418Z",
"updated_at": "2016-06-14T15:02:57.013Z",
"state": "opened",
diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
index 5fdd4d5f25f..4d857945fde 100644
--- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
@@ -71,6 +71,28 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
expect(Milestone.find_by_description('test milestone').issues).not_to be_empty
end
+
+ context 'Merge requests' do
+ before do
+ restored_project_json
+ end
+
+ it 'always has the new project as a target' do
+ expect(MergeRequest.find_by_title('MR1').target_project).to eq(project)
+ end
+
+ it 'has the same source project as originally if source/target are the same' do
+ expect(MergeRequest.find_by_title('MR1').source_project).to eq(project)
+ end
+
+ it 'has the new project as target if source/target differ' do
+ expect(MergeRequest.find_by_title('MR2').target_project).to eq(project)
+ end
+
+ it 'has no source if source/target differ' do
+ expect(MergeRequest.find_by_title('MR2').source_project_id).to eq(-1)
+ end
+ end
end
end
end