diff options
author | James Lopez <james@jameslopez.es> | 2018-06-19 11:25:58 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-06-19 11:25:58 +0200 |
commit | fe56d29d300ccbb26328886166e07c84fc247155 (patch) | |
tree | 983c69079253d7ee4a593b2a98e54caeafeb2c3d /spec | |
parent | b99bc6d38088b7b87f6ffa4a706ab5eacb489449 (diff) | |
download | gitlab-ce-fe56d29d300ccbb26328886166e07c84fc247155.tar.gz |
update spec
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/import_export/group_project_finder_spec.rb | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/spec/lib/gitlab/import_export/group_project_finder_spec.rb b/spec/lib/gitlab/import_export/group_project_finder_spec.rb index 17239c150ab..a86f0c2dd44 100644 --- a/spec/lib/gitlab/import_export/group_project_finder_spec.rb +++ b/spec/lib/gitlab/import_export/group_project_finder_spec.rb @@ -10,12 +10,61 @@ describe Gitlab::ImportExport::GroupProjectFinder do group: create(:group)) end - it 'finds the right group label' do - group_label = create(:group_label, 'name': 'group label', 'group': project.group) + context 'labels' do + it 'finds the right group label' do + group_label = create(:group_label, 'name': 'group label', 'group': project.group) - expect(described_class.find(Label, - title: 'group label', - 'project_id': project.id, - 'group_id': project.group.id)).to eq([group_label]) + expect(described_class.find_or_new(Label, + title: 'group label', + 'project_id' => project.id, + 'group_id' => project.group.id)).to eq(group_label) + end + + it 'initializes a new label' do + label = described_class.find_or_new(Label, + title: 'group label', + 'project_id' => project.id, + 'group_id' => project.group.id) + + expect(label.persisted?).to be false + end + + it 'creates a new label' do + label = described_class.find_or_create(Label, + title: 'group label', + 'project_id' => project.id, + 'group_id' => project.group.id) + + expect(label.persisted?).to be true + end + end + + context 'milestones' do + it 'finds the right group milestone' do + milestone = create(:milestone, 'name' => 'group milestone', 'group' => project.group) + + expect(described_class.find_or_new(Milestone, + title: 'group milestone', + 'project_id' => project.id, + 'group_id' => project.group.id)).to eq(milestone) + end + + it 'initializes a new milestone' do + milestone = described_class.find_or_new(Milestone, + title: 'group milestone', + 'project_id' => project.id, + 'group_id' => project.group.id) + + expect(milestone.persisted?).to be false + end + + it 'creates a new milestone' do + milestone = described_class.find_or_create(Milestone, + title: 'group milestone', + 'project_id' => project.id, + 'group_id' => project.group.id) + + expect(milestone.persisted?).to be true + end end end |