summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-12-23 14:09:42 +0000
committerRémy Coutable <remy@rymai.me>2017-12-23 14:09:42 +0000
commit6c967c2b5b9760d0df6bcff70c059858abf971ec (patch)
tree6c184f3d48efc26eb39ab880c71dc5b4cd46bfa9 /features
parent5512f0aaf5a4814fbea5a697076a97ff2db00c00 (diff)
parent27c95364b52f4e93054c45211010aeb22e40a2b2 (diff)
downloadgitlab-ce-6c967c2b5b9760d0df6bcff70c059858abf971ec.tar.gz
Merge branch '36782-replace-team-user-role-with-add_role-user-in-specs' into 'master'
Resolve "Replace '.team << [user, role]' with 'add_role(user)' in specs" Closes #36782 See merge request gitlab-org/gitlab-ce!16069
Diffstat (limited to 'features')
-rw-r--r--features/steps/profile/profile.rb2
-rw-r--r--features/steps/project/deploy_keys.rb4
-rw-r--r--features/steps/project/fork.rb4
-rw-r--r--features/steps/project/forked_merge_requests.rb2
-rw-r--r--features/steps/project/source/browse_files.rb2
-rw-r--r--features/steps/project/source/markdown_render.rb2
-rw-r--r--features/steps/shared/group.rb2
-rw-r--r--features/steps/shared/project.rb21
8 files changed, 19 insertions, 20 deletions
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