add spec replicating both label and milestone duplicated title issues

This commit is contained in:
James Lopez 2018-06-18 15:14:20 +02:00
parent a170c587a0
commit f5e4adc9bf
No known key found for this signature in database
GPG key ID: 756BF8E9D7C0CF39
2 changed files with 38 additions and 5 deletions

View file

@ -7,7 +7,7 @@
"milestones": [
{
"id": 1,
"title": "Project milestone",
"title": "A milestone",
"project_id": 8,
"description": "Project-level milestone",
"due_date": null,
@ -66,7 +66,7 @@
"group_milestone_id": null,
"milestone": {
"id": 1,
"title": "Project milestone",
"title": "A milestone",
"project_id": 8,
"description": "Project-level milestone",
"due_date": null,
@ -86,7 +86,7 @@
"updated_at": "2017-08-15T18:37:40.795Z",
"label": {
"id": 6,
"title": "Another project label",
"title": "Another label",
"color": "#A8D695",
"project_id": null,
"created_at": "2017-08-15T18:37:19.698Z",

View file

@ -189,8 +189,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
@project.pipelines.zip([2, 2, 2, 2, 2])
.each do |(pipeline, expected_status_size)|
expect(pipeline.statuses.size).to eq(expected_status_size)
end
expect(pipeline.statuses.size).to eq(expected_status_size)
end
end
end
@ -368,5 +368,38 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
milestones: 1,
first_issue_labels: 1
end
context 'with existing group models' do
let!(:project) do
create(:project,
:builds_disabled,
:issues_disabled,
name: 'project',
path: 'project',
group: create(:group))
end
before do
project_tree_restorer.instance_variable_set(:@path, "spec/lib/gitlab/import_export/project.light.json")
end
it 'imports labels' do
create(:group_label, name: 'Another label', group: project.group)
expect_any_instance_of(Gitlab::ImportExport::Shared).not_to receive(:error)
restored_project_json
expect(project.labels.count).to eq(1)
end
it 'imports milestones' do
create(:milestone, name: 'A milestone', group: project.group)
expect_any_instance_of(Gitlab::ImportExport::Shared).not_to receive(:error)
restored_project_json
expect(project.milestones.count).to eq(1)
end
end
end
end