From 27c95364b52f4e93054c45211010aeb22e40a2b2 Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Fri, 22 Dec 2017 19:18:28 +1100 Subject: Replace '.team << [user, role]' with 'add_role(user)' in specs --- features/steps/profile/profile.rb | 2 +- features/steps/project/deploy_keys.rb | 4 ++-- features/steps/project/fork.rb | 4 ++-- features/steps/project/forked_merge_requests.rb | 2 +- features/steps/project/source/browse_files.rb | 2 +- features/steps/project/source/markdown_render.rb | 2 +- features/steps/shared/group.rb | 2 +- features/steps/shared/project.rb | 21 ++++++++++----------- 8 files changed, 19 insertions(+), 20 deletions(-) (limited to 'features') diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 4b88cb5e27f..d3b88ae8d2a 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -165,7 +165,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps @project = create(:project, :repository, namespace: @group) @event = create(:closed_issue_event, project: @project) - @project.team << [current_user, :master] + @project.add_master(current_user) end step 'I should see groups I belong to' do diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index b4403becb0d..9db31522c5c 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -48,11 +48,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps step 'other projects have deploy keys' do @second_project = create(:project, namespace: create(:group)) - @second_project.team << [current_user, :master] + @second_project.add_master(current_user) create(:deploy_keys_project, project: @second_project) @third_project = create(:project, namespace: create(:group)) - @third_project.team << [current_user, :master] + @third_project.add_master(current_user) create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first) end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 60707f26aee..0350e1c2aef 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps step 'I am a member of project "Shop"' do @project = create(:project, :repository, name: "Shop") - @project.team << [@user, :reporter] + @project.add_reporter(@user) end step 'I should see the forked project page' do @@ -71,7 +71,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps step 'There is an existent fork of the "Shop" project' do user = create(:user, name: 'Mike') - @project.team << [user, :reporter] + @project.add_reporter(user) @forked_project = Projects::ForkService.new(@project, user).execute end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 6781a906a94..fd51ee1a316 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps step 'I am a member of project "Shop"' do @project = ::Project.find_by(name: "Shop") @project ||= create(:project, :repository, name: "Shop") - @project.team << [@user, :reporter] + @project.add_reporter(@user) end step 'I have a project forked off of "Shop" called "Forked Shop"' do diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 93b057430d3..afaad4b255e 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -8,7 +8,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step "I don't have write access" do @project = create(:project, :repository, name: "Other Project", path: "other-project") - @project.team << [@user, :reporter] + @project.add_reporter(@user) visit project_tree_path(@project, root_ref) end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index f6445b57ec0..fc4ef26f6b6 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps step 'I own project "Delta"' do @project = ::Project.find_by(name: "Delta") @project ||= create(:project, :repository, name: "Delta", namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step 'I should see files from repository in markdown' do diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb index 03bc7e798e0..0a0588346b1 100644 --- a/features/steps/shared/group.rb +++ b/features/steps/shared/group.rb @@ -41,7 +41,7 @@ module SharedGroup group.add_user(user, role) project ||= create(:project, :repository, namespace: group) create(:closed_issue_event, project: project) - project.team << [user, :master] + project.add_master(user) end def owned_group diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 5e4edaf99a6..affbccccdf9 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -4,13 +4,13 @@ module SharedProject # Create a project without caring about what it's called step "I own a project" do @project = create(:project, :repository, namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step "I own a project in some group namespace" do @group = create(:group, name: 'some group') @project = create(:project, namespace: @group) - @project.team << [@user, :master] + @project.add_master(@user) end step "project exists in some group namespace" do @@ -22,7 +22,7 @@ module SharedProject step 'I own project "Shop"' do @project = Project.find_by(name: "Shop") @project ||= create(:project, :repository, name: "Shop", namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step 'I disable snippets in project' do @@ -40,7 +40,7 @@ module SharedProject step 'I add a user to project "Shop"' do @project = Project.find_by(name: "Shop") other_user = create(:user, name: 'Alpha') - @project.team << [other_user, :master] + @project.add_master(other_user) end # Create another specific project called "Forum" @@ -49,14 +49,13 @@ module SharedProject @project ||= create(:project, :repository, name: "Forum", namespace: @user.namespace, path: 'forum_project') @project.build_project_feature @project.project_feature.save - @project.team << [@user, :master] + @project.add_master(@user) end # Create an empty project without caring about the name step 'I own an empty project' do - @project = create(:project, - name: 'Empty Project', namespace: @user.namespace) - @project.team << [@user, :master] + @project = create(:project, name: 'Empty Project', namespace: @user.namespace) + @project.add_master(@user) end step 'I visit my empty project page' do @@ -101,11 +100,11 @@ module SharedProject # ---------------------------------------- step 'I am member of a project with a guest role' do - @project.team << [@user, Gitlab::Access::GUEST] + @project.add_guest(@user) end step 'I am member of a project with a reporter role' do - @project.team << [@user, Gitlab::Access::REPORTER] + @project.add_reporter(@user) end # ---------------------------------------- @@ -245,6 +244,6 @@ module SharedProject user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore) project = Project.find_by(name: project_name) project ||= create(:project, visibility, name: project_name, namespace: user.namespace) - project.team << [user, :master] + project.add_master(user) end end -- cgit v1.2.1