diff options
Diffstat (limited to 'spec/services/projects/fork_service_spec.rb')
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 48756cf774b..4ba72b5870d 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ForkService do +RSpec.describe Projects::ForkService, feature_category: :source_code_management do include ProjectForksHelper shared_examples 'forks count cache refresh' do @@ -22,14 +22,16 @@ RSpec.describe Projects::ForkService do @from_user = create(:user) @from_namespace = @from_user.namespace avatar = fixture_file_upload("spec/fixtures/dk.png", "image/png") - @from_project = create(:project, - :repository, - creator_id: @from_user.id, - namespace: @from_namespace, - star_count: 107, - avatar: avatar, - description: 'wow such project', - external_authorization_classification_label: 'classification-label') + @from_project = create( + :project, + :repository, + creator_id: @from_user.id, + namespace: @from_namespace, + star_count: 107, + avatar: avatar, + description: 'wow such project', + external_authorization_classification_label: 'classification-label' + ) @to_user = create(:user) @to_namespace = @to_user.namespace @from_project.add_member(@to_user, :developer) @@ -148,12 +150,11 @@ RSpec.describe Projects::ForkService do context 'project already exists' do it "fails due to validation, not transaction failure" do - @existing_project = create(:project, :repository, creator_id: @to_user.id, name: @from_project.name, namespace: @to_namespace) + @existing_project = create(:project, :repository, creator_id: @to_user.id, path: @from_project.path, namespace: @to_namespace) @to_project = fork_project(@from_project, @to_user, namespace: @to_namespace, using_service: true) expect(@existing_project).to be_persisted expect(@to_project).not_to be_persisted - expect(@to_project.errors[:name]).to eq(['has already been taken']) expect(@to_project.errors[:path]).to eq(['has already been taken']) end end @@ -258,11 +259,13 @@ RSpec.describe Projects::ForkService do before do @group_owner = create(:user) @developer = create(:user) - @project = create(:project, :repository, - creator_id: @group_owner.id, - star_count: 777, - description: 'Wow, such a cool project!', - ci_config_path: 'debian/salsa-ci.yml') + @project = create( + :project, :repository, + creator_id: @group_owner.id, + star_count: 777, + description: 'Wow, such a cool project!', + ci_config_path: 'debian/salsa-ci.yml' + ) @group = create(:group) @group.add_member(@group_owner, GroupMember::OWNER) @group.add_member(@developer, GroupMember::DEVELOPER) @@ -297,12 +300,9 @@ RSpec.describe Projects::ForkService do context 'project already exists in group' do it 'fails due to validation, not transaction failure' do - existing_project = create(:project, :repository, - name: @project.name, - namespace: @group) + existing_project = create(:project, :repository, path: @project.path, namespace: @group) to_project = fork_project(@project, @group_owner, @opts) expect(existing_project.persisted?).to be_truthy - expect(to_project.errors[:name]).to eq(['has already been taken']) expect(to_project.errors[:path]).to eq(['has already been taken']) end end |