diff options
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/import_export/project.light.json | 70 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/project_tree_restorer_spec.rb | 23 |
2 files changed, 90 insertions, 3 deletions
diff --git a/spec/lib/gitlab/import_export/project.light.json b/spec/lib/gitlab/import_export/project.light.json index 6949d01f70c..2d8f3d4a566 100644 --- a/spec/lib/gitlab/import_export/project.light.json +++ b/spec/lib/gitlab/import_export/project.light.json @@ -39,6 +39,76 @@ ] } ], + "issues": [ + { + "id": 1, + "title": "Fugiat est minima quae maxime non similique.", + "assignee_id": null, + "project_id": 8, + "author_id": 1, + "created_at": "2017-07-07T18:13:01.138Z", + "updated_at": "2017-08-15T18:37:40.807Z", + "branch_name": null, + "description": "Quam totam fuga numquam in eveniet.", + "state": "opened", + "iid": 20, + "updated_by_id": 1, + "confidential": false, + "deleted_at": null, + "due_date": null, + "moved_to_id": null, + "lock_version": null, + "time_estimate": 0, + "closed_at": null, + "last_edited_at": null, + "last_edited_by_id": null, + "group_milestone_id": null, + "label_links": [ + { + "id": 11, + "label_id": 6, + "target_id": 1, + "target_type": "Issue", + "created_at": "2017-08-15T18:37:40.795Z", + "updated_at": "2017-08-15T18:37:40.795Z", + "label": { + "id": 6, + "title": "group label", + "color": "#A8D695", + "project_id": null, + "created_at": "2017-08-15T18:37:19.698Z", + "updated_at": "2017-08-15T18:37:19.698Z", + "template": false, + "description": "", + "group_id": 5, + "type": "GroupLabel", + "priorities": [] + } + }, + { + "id": 11, + "label_id": 2, + "target_id": 1, + "target_type": "Issue", + "created_at": "2017-08-15T18:37:40.795Z", + "updated_at": "2017-08-15T18:37:40.795Z", + "label": { + "id": 6, + "title": "project label", + "color": "#A8D695", + "project_id": null, + "created_at": "2017-08-15T18:37:19.698Z", + "updated_at": "2017-08-15T18:37:19.698Z", + "template": false, + "description": "", + "group_id": 5, + "type": "ProjectLabel", + "priorities": [] + } + } + ] + } + ], "snippets": [ ], 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 cf6bd894c08..956f1d56eb4 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -183,7 +183,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do let(:restored_project_json) { project_tree_restorer.restore } before do - allow(ImportExport).to receive(:project_filename).and_return('project.light.json') + project_tree_restorer.instance_variable_set(:@path, "spec/lib/gitlab/import_export/project.light.json") + allow(shared).to receive(:export_path).and_return('spec/lib/gitlab/import_export/') end @@ -195,7 +196,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do restored_project_json - expect(shared.errors.first).not_to include('test') + expect(shared.errors.first).to be_nil end end end @@ -230,7 +231,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end it 'has labels' do - expect(project.labels.count).to eq(1) + expect(project.labels.count).to eq(2) + end + + it 'creates group label' do + expect(project.group.labels.count).to eq(1) end it 'has label priorities' do @@ -240,6 +245,18 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do it 'has milestones' do expect(project.milestones.count).to eq(1) end + + it 'has issue' do + expect(project.issues.count).to eq(1) + expect(project.issues.first.labels.count).to eq(2) + end + + it 'has issue with group label and project label' do + labels = project.issues.first.labels + + expect(labels.where(type: "GroupLabel").count).to eq(1) + expect(labels.where(type: "ProjectLabel").count).to eq(1) + end end end end |