diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-01-24 14:02:11 +0100 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-01-24 14:02:11 +0100 |
commit | 54bcb6cc2a863e10abdd76745d3a0d50c301ab77 (patch) | |
tree | b374b46630cb1663ff8b6657a895b8087242fcfe /features | |
parent | d819d0d1f84946bcc0d2c871682c220db6dbd478 (diff) | |
parent | d1d138562a347ec78f0331d5242e28fbb368bad0 (diff) | |
download | gitlab-ce-54bcb6cc2a863e10abdd76745d3a0d50c301ab77.tar.gz |
Merge branch 'master' into reference_relative_links
Conflicts:
spec/models/project_spec.rb
Diffstat (limited to 'features')
30 files changed, 123 insertions, 114 deletions
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index 4e4ac1a68e4..946f6760126 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -55,18 +55,18 @@ Feature: Project Merge Requests Given project "Shop" have "Bug NS-05" open merge request with diffs inside And I visit merge request page "Bug NS-05" And I click on the first commit in the merge request - And I leave a comment like "Line is wrong" on line 185 of the first file + And I leave a comment like "Line is wrong" on line 185 of the first file in commit And I switch to the merge request's comments tab - Then I should see a discussion has started on commit bcf03b5de6c:L185 + Then I should see a discussion has started on commit b1e6a9dbf1:L185 @javascript Scenario: I comment on a commit in merge request Given project "Shop" have "Bug NS-05" open merge request with diffs inside And I visit merge request page "Bug NS-05" And I click on the first commit in the merge request - And I leave a comment on the diff page + And I leave a comment on the diff page in commit And I switch to the merge request's comments tab - Then I should see a discussion has started on commit bcf03b5de6c + Then I should see a discussion has started on commit b1e6a9dbf1 @javascript Scenario: I accept merge request with custom commit message diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index b4591f227e3..013fa6da8b4 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -40,7 +40,7 @@ class AdminGroups < Spinach::FeatureSteps end When 'I select user "John" from user list as "Reporter"' do - user = User.find_by_name("John") + user = User.find_by(name: "John") select2(user.id, from: "#user_ids", multiple: true) within "#new_team_member" do select "Reporter", from: "group_access" diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index bde32128b92..3526006c94a 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -43,7 +43,7 @@ class Dashboard < Spinach::FeatureSteps end And 'user with name "John Doe" left project "Shop"' do - user = User.find_by_name "John Doe" + user = User.find_by(name: "John Doe") Event.create( project: project, author_id: user.id, @@ -85,6 +85,6 @@ class Dashboard < Spinach::FeatureSteps end def project - @project ||= Project.find_by_name "Shop" + @project ||= Project.find_by(name: "Shop") end end diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb index a458acdae07..1344edfa80b 100644 --- a/features/steps/dashboard/dashboard_issues.rb +++ b/features/steps/dashboard/dashboard_issues.rb @@ -66,7 +66,7 @@ class DashboardIssues < Spinach::FeatureSteps def project @project ||= begin - project =create :project_with_code + project =create :project project.team << [current_user, :master] project end diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb index 73286532b93..62d84506c49 100644 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -66,7 +66,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps def project @project ||= begin - project =create :project_with_code + project =create :project project.team << [current_user, :master] project end diff --git a/features/steps/dashboard/dashboard_with_archived_projects.rb b/features/steps/dashboard/dashboard_with_archived_projects.rb index 700f4b426c3..1bc69555b56 100644 --- a/features/steps/dashboard/dashboard_with_archived_projects.rb +++ b/features/steps/dashboard/dashboard_with_archived_projects.rb @@ -4,7 +4,7 @@ class DashboardWithArchivedProjects < Spinach::FeatureSteps include SharedProject When 'project "Forum" is archived' do - project = Project.find_by_name "Forum" + project = Project.find_by(name: "Forum") project.update_attribute(:archived, true) end diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index bcadf21c233..15d7c46c694 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -39,7 +39,7 @@ class Groups < Spinach::FeatureSteps end And 'I select user "John" from list with role "Reporter"' do - user = User.find_by_name("John") + user = User.find_by(name: "John") within ".users-group-form" do select2(user.id, from: "#user_ids", multiple: true) select "Reporter", from: "group_access" diff --git a/features/steps/profile/profile_ssh_keys.rb b/features/steps/profile/profile_ssh_keys.rb index 65bfc505d85..65ca824bb5b 100644 --- a/features/steps/profile/profile_ssh_keys.rb +++ b/features/steps/profile/profile_ssh_keys.rb @@ -18,7 +18,7 @@ class ProfileSshKeys < Spinach::FeatureSteps end Then 'I should see new ssh key "Laptop"' do - key = Key.find_by_title("Laptop") + key = Key.find_by(title: "Laptop") page.should have_content(key.title) page.should have_content(key.key) current_path.should == profile_key_path(key) diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index 7f7492bfd6d..914da31322f 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -34,7 +34,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'other project has deploy key' do - @second_project = create :project, namespace: current_user.namespace + @second_project = create :project, namespace: create(:group) @second_project.team << [current_user, :master] create(:deploy_keys_project, project: @second_project) end diff --git a/features/steps/project/project_archived.rb b/features/steps/project/project_archived.rb index 149d293cd08..dfbe762c438 100644 --- a/features/steps/project/project_archived.rb +++ b/features/steps/project/project_archived.rb @@ -4,17 +4,17 @@ class ProjectArchived < Spinach::FeatureSteps include SharedPaths When 'project "Forum" is archived' do - project = Project.find_by_name "Forum" + project = Project.find_by(name: "Forum") project.update_attribute(:archived, true) end When 'project "Shop" is archived' do - project = Project.find_by_name "Shop" + project = Project.find_by(name: "Shop") project.update_attribute(:archived, true) end When 'I visit project "Forum" page' do - project = Project.find_by_name "Forum" + project = Project.find_by(name: "Forum") visit project_path(project) end diff --git a/features/steps/project/project_browse_branches.rb b/features/steps/project/project_browse_branches.rb index e77825411f3..ef29cc67a4e 100644 --- a/features/steps/project/project_browse_branches.rb +++ b/features/steps/project/project_browse_branches.rb @@ -29,7 +29,7 @@ class ProjectBrowseBranches < Spinach::FeatureSteps end And 'project "Shop" has protected branches' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") project.protected_branches.create(name: "stable") end end diff --git a/features/steps/project/project_fork.rb b/features/steps/project/project_fork.rb index 858c7d11b32..c00d9014b1d 100644 --- a/features/steps/project/project_fork.rb +++ b/features/steps/project/project_fork.rb @@ -11,22 +11,22 @@ class ForkProject < Spinach::FeatureSteps end step 'I am a member of project "Shop"' do - @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop", group: create(:group)) + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop", group: create(:group)) @project.team << [@user, :reporter] end step 'I should see the forked project page' do page.should have_content "Project was successfully forked." current_path.should include current_user.namespace.path - @forked_project = Project.find_by_namespace_id(current_user.namespace.path) + @forked_project = Project.find_by(namespace_id: current_user.namespace.path) end step 'I already have a project named "Shop" in my namespace' do current_user.namespace ||= create(:namespace) current_user.namespace.should_not be_nil current_user.namespace.path.should_not be_nil - @my_project = create(:project_with_code, name: "Shop", namespace: current_user.namespace) + @my_project = create(:project, name: "Shop", namespace: current_user.namespace) end step 'I should see a "Name has already been taken" warning' do diff --git a/features/steps/project/project_forked_merge_requests.rb b/features/steps/project/project_forked_merge_requests.rb index d34aeac30bb..4cc99f8af55 100644 --- a/features/steps/project/project_forked_merge_requests.rb +++ b/features/steps/project/project_forked_merge_requests.rb @@ -6,16 +6,16 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps include Select2Helper step 'I am a member of project "Shop"' do - @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop") + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop") @project.team << [@user, :reporter] end step 'I have a project forked off of "Shop" called "Forked Shop"' do @forking_user = @user forked_project_link = build(:forked_project_link) - @forked_project = Project.find_by_name "Forked Shop" - @forked_project ||= create(:source_project_with_code, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) + @forked_project = Project.find_by(name: "Forked Shop") + @forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) forked_project_link.forked_from_project = @project forked_project_link.forked_to_project = @forked_project @@ -114,7 +114,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'project "Forked Shop" has push event' do - @forked_project = Project.find_by_name("Forked Shop") + @forked_project = Project.find_by(name: "Forked Shop") data = { before: "0000000000000000000000000000000000000000", @@ -172,7 +172,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps end def project - @project ||= Project.find_by_name!("Shop") + @project ||= Project.find_by!(name: "Shop") end # Verify a link is generated against the correct project diff --git a/features/steps/project/project_graph.rb b/features/steps/project/project_graph.rb index 50942b3cbb3..89fe5fdeadf 100644 --- a/features/steps/project/project_graph.rb +++ b/features/steps/project/project_graph.rb @@ -7,7 +7,7 @@ class ProjectGraph < Spinach::FeatureSteps end When 'I visit project "Shop" graph page' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") visit project_graph_path(project, "master") end end diff --git a/features/steps/project/project_issue_tracker.rb b/features/steps/project/project_issue_tracker.rb index a05d7a0bc37..c2fd4e15c9e 100644 --- a/features/steps/project/project_issue_tracker.rb +++ b/features/steps/project/project_issue_tracker.rb @@ -4,8 +4,8 @@ class ProjectIssueTracker < Spinach::FeatureSteps include SharedPaths step 'project "Shop" has issues enabled' do - @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop", namespace: @user.namespace) + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop", namespace: @user.namespace) @project.issues_enabled = true end diff --git a/features/steps/project/project_issues.rb b/features/steps/project/project_issues.rb index 801fff78a52..4a503dfaf4f 100644 --- a/features/steps/project/project_issues.rb +++ b/features/steps/project/project_issues.rb @@ -54,7 +54,7 @@ class ProjectIssues < Spinach::FeatureSteps end Then 'I should see issue "500 error on profile"' do - issue = Issue.find_by_title("500 error on profile") + issue = Issue.find_by(title: "500 error on profile") page.should have_content issue.title page.should have_content issue.author_name page.should have_content issue.project.name @@ -81,14 +81,14 @@ class ProjectIssues < Spinach::FeatureSteps end Given 'project "Shop" has milestone "v2.2"' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") milestone = create(:milestone, title: "v2.2", project: project) 3.times { create(:issue, project: project, milestone: milestone) } end And 'project "Shop" has milestone "v3.0"' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") milestone = create(:milestone, title: "v3.0", project: project) 3.times { create(:issue, project: project, milestone: milestone) } @@ -104,20 +104,20 @@ class ProjectIssues < Spinach::FeatureSteps end When 'I select first assignee from "Shop" project' do - project = Project.find_by_name "Shop" + project = Project.find_by(name: "Shop") first_assignee = project.users.first select first_assignee.name, from: "assignee_id" end Then 'I should see first assignee from "Shop" as selected assignee' do issues_assignee_selector = "#issue_assignee_id_chzn > a" - project = Project.find_by_name "Shop" + project = Project.find_by(name: "Shop") assignee_name = project.users.first.name page.find(issues_assignee_selector).should have_content(assignee_name) end And 'project "Shop" have "Release 0.4" open issue' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") create(:issue, title: "Release 0.4", project: project, @@ -125,7 +125,7 @@ class ProjectIssues < Spinach::FeatureSteps end And 'project "Shop" have "Tweet control" open issue' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") create(:issue, title: "Tweet control", project: project, @@ -133,7 +133,7 @@ class ProjectIssues < Spinach::FeatureSteps end And 'project "Shop" have "Release 0.3" closed issue' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") create(:closed_issue, title: "Release 0.3", project: project, diff --git a/features/steps/project/project_labels.rb b/features/steps/project/project_labels.rb index 915190f3dae..0907cdb526f 100644 --- a/features/steps/project/project_labels.rb +++ b/features/steps/project/project_labels.rb @@ -16,7 +16,7 @@ class ProjectLabels < Spinach::FeatureSteps end And 'project "Shop" have issues tags: "bug", "feature"' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") ['bug', 'feature'].each do |label| create(:issue, project: project, label_list: label) end diff --git a/features/steps/project/project_markdown_render.rb b/features/steps/project/project_markdown_render.rb index a6c13b41e91..1209aae6434 100644 --- a/features/steps/project/project_markdown_render.rb +++ b/features/steps/project/project_markdown_render.rb @@ -3,8 +3,8 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps include SharedPaths And 'I own project "Delta"' do - @project = Project.find_by_name "Delta" - @project ||= create(:project_with_code, name: "Delta", namespace: @user.namespace) + @project = Project.find_by(name: "Delta") + @project ||= create(:project, name: "Delta", namespace: @user.namespace) @project.team << [@user, :master] end diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 8ef952cf3d1..0c5f05a0a68 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -27,7 +27,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see closed merge request "Bug NS-04"' do - merge_request = MergeRequest.find_by_title!("Bug NS-04") + merge_request = MergeRequest.find_by!(title: "Bug NS-04") merge_request.closed?.should be_true page.should have_content "Closed by" end @@ -81,6 +81,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps title: "Bug NS-04", source_project: project, target_project: project, + source_branch: 'stable', + target_branch: 'master', author: project.users.first) end @@ -109,33 +111,29 @@ class ProjectMergeRequests < Spinach::FeatureSteps end step 'I click on the first commit in the merge request' do - click_link merge_request.commits.first.short_id(8) + within '.first-commits' do + click_link merge_request.commits.first.short_id(8) + end end step 'I leave a comment on the diff page' do init_diff_note + leave_comment "One comment to rule them all" + end - within('.js-discussion-note-form') do - fill_in "note_note", with: "One comment to rule them all" - click_button "Add Comment" - end - - within ".note-text" do - page.should have_content "One comment to rule them all" - end + step 'I leave a comment on the diff page in commit' do + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click + leave_comment "One comment to rule them all" end step 'I leave a comment like "Line is wrong" on line 185 of the first file' do init_diff_note + leave_comment "Line is wrong" + end - within(".js-discussion-note-form") do - fill_in "note_note", with: "Line is wrong" - click_button "Add Comment" - end - - within ".note-text" do - page.should have_content "Line is wrong" - end + step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click + leave_comment "Line is wrong" end step 'I should see a discussion has started on line 185' do @@ -144,14 +142,14 @@ class ProjectMergeRequests < Spinach::FeatureSteps page.should have_content "Line is wrong" end - step 'I should see a discussion has started on commit bcf03b5de6c:L185' do + step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do page.should have_content "#{current_user.name} started a discussion on commit" page.should have_content "app/assets/stylesheets/tree.scss:L185" page.should have_content "Line is wrong" end - step 'I should see a discussion has started on commit bcf03b5de6c' do - page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c" + step 'I should see a discussion has started on commit b1e6a9dbf1' do + page.should have_content "#{current_user.name} started a discussion on commit" page.should have_content "One comment to rule them all" page.should have_content "app/assets/stylesheets/tree.scss:L185" end @@ -180,14 +178,25 @@ class ProjectMergeRequests < Spinach::FeatureSteps end def project - @project ||= Project.find_by_name!("Shop") + @project ||= Project.find_by!(name: "Shop") end def merge_request - @merge_request ||= MergeRequest.find_by_title!("Bug NS-05") + @merge_request ||= MergeRequest.find_by!(title: "Bug NS-05") end def init_diff_note - find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click + end + + def leave_comment(message) + within(".js-discussion-note-form") do + fill_in "note_note", with: message + click_button "Add Comment" + end + + within ".note-text" do + page.should have_content message + end end end diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb index c4d0d176f3a..85962221c0f 100644 --- a/features/steps/project/project_milestones.rb +++ b/features/steps/project/project_milestones.rb @@ -4,7 +4,7 @@ class ProjectMilestones < Spinach::FeatureSteps include SharedPaths Then 'I should see milestone "v2.2"' do - milestone = @project.milestones.find_by_title("v2.2") + milestone = @project.milestones.find_by(title: "v2.2") page.should have_content(milestone.title[0..10]) page.should have_content(milestone.expires_at) page.should have_content("Browse Issues") @@ -24,22 +24,22 @@ class ProjectMilestones < Spinach::FeatureSteps end Then 'I should see milestone "v2.3"' do - milestone = @project.milestones.find_by_title("v2.3") + milestone = @project.milestones.find_by(title: "v2.3") page.should have_content(milestone.title[0..10]) page.should have_content(milestone.expires_at) page.should have_content("Browse Issues") end And 'project "Shop" has milestone "v2.2"' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") milestone = create(:milestone, title: "v2.2", project: project) 3.times { create(:issue, project: project, milestone: milestone) } end Given 'the milestone has open and closed issues' do - project = Project.find_by_name("Shop") - milestone = project.milestones.find_by_title('v2.2') + project = Project.find_by(name: "Shop") + milestone = project.milestones.find_by(title: 'v2.2') # 3 Open issues created above; create one closed issue create(:closed_issue, project: project, milestone: milestone) diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb index bc228e6e68a..c7d9ece6feb 100644 --- a/features/steps/project/project_network_graph.rb +++ b/features/steps/project/project_network_graph.rb @@ -10,7 +10,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps # Stub Graph max_size to speed up test (10 commits vs. 650) Network::Graph.stub(max_count: 10) - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") visit project_network_path(project, "master") end diff --git a/features/steps/project/project_snippets.rb b/features/steps/project/project_snippets.rb index 82ff895970e..c3a76bea269 100644 --- a/features/steps/project/project_snippets.rb +++ b/features/steps/project/project_snippets.rb @@ -90,10 +90,10 @@ class ProjectSnippets < Spinach::FeatureSteps end def project - @project ||= Project.find_by_name!("Shop") + @project ||= Project.find_by!(name: "Shop") end def project_snippet - @project_snippet ||= ProjectSnippet.find_by_title!("Snippet One") + @project_snippet ||= ProjectSnippet.find_by!(title: "Snippet one") end end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb index efebba1be24..ffc5016529f 100644 --- a/features/steps/project/project_team_management.rb +++ b/features/steps/project/project_team_management.rb @@ -10,7 +10,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps end And 'I should see "Sam" in team list' do - user = User.find_by_name("Sam") + user = User.find_by(name: "Sam") page.should have_content(user.name) page.should have_content(user.username) end @@ -20,7 +20,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps end And 'I select "Mike" as "Reporter"' do - user = User.find_by_name("Mike") + user = User.find_by(name: "Mike") select2(user.id, from: "#user_ids", multiple: true) within "#new_team_member" do @@ -42,7 +42,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps end And 'I change "Sam" role to "Reporter"' do - user = User.find_by_name("Sam") + user = User.find_by(name: "Sam") within "#user_#{user.id}" do select "Reporter", from: "team_member_project_access" end @@ -59,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps end And 'I should not see "Sam" in team list' do - user = User.find_by_name("Sam") + user = User.find_by(name: "Sam") page.should_not have_content(user.name) page.should_not have_content(user.username) end @@ -73,19 +73,19 @@ class ProjectTeamManagement < Spinach::FeatureSteps end And '"Sam" is "Shop" developer' do - user = User.find_by_name("Sam") - project = Project.find_by_name("Shop") + user = User.find_by(name: "Sam") + project = Project.find_by(name: "Shop") project.team << [user, :developer] end Given 'I own project "Website"' do - @project = create(:project, name: "Website", namespace: @user.namespace) + @project = create(:empty_project, name: "Website", namespace: @user.namespace) @project.team << [@user, :master] end And '"Mike" is "Website" reporter' do - user = User.find_by_name("Mike") - project = Project.find_by_name("Website") + user = User.find_by(name: "Mike") + project = Project.find_by(name: "Website") project.team << [user, :reporter] end @@ -94,13 +94,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps end When 'I submit "Website" project for import team' do - project = Project.find_by_name("Website") + project = Project.find_by(name: "Website") select project.name_with_namespace, from: 'source_project_id' click_button 'Import' end step 'I click cancel link for "Sam"' do - within "#user_#{User.find_by_name('Sam').id}" do + within "#user_#{User.find_by(name: 'Sam').id}" do click_link('Remove user from team') end end diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 4ac53075704..76ffea1bb6f 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -4,7 +4,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps include SharedProject step 'public project "Community"' do - create :project_with_code, name: 'Community', visibility_level: Gitlab::VisibilityLevel::PUBLIC + create :project, name: 'Community', visibility_level: Gitlab::VisibilityLevel::PUBLIC end step 'private project "Enterprise"' do @@ -12,7 +12,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps end step 'I visit project "Community" page' do - project = Project.find_by_name('Community') + project = Project.find_by(name: 'Community') visit project_path(project) end @@ -23,12 +23,12 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps end step 'I visit project "Enterprise" page' do - project = Project.find_by_name('Enterprise') + project = Project.find_by(name: 'Enterprise') visit project_path(project) end step 'I visit project "CommunityDoesNotExist" page' do - project = Project.find_by_name('Community') + project = Project.find_by(name: 'Community') visit project_path(project) + 'DoesNotExist' end end diff --git a/features/steps/public/projects_feature.rb b/features/steps/public/projects_feature.rb index 47e52f47d07..c3ec10b87d3 100644 --- a/features/steps/public/projects_feature.rb +++ b/features/steps/public/projects_feature.rb @@ -25,20 +25,20 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'public project "Community"' do - create :project_with_code, name: 'Community', visibility_level: Gitlab::VisibilityLevel::PUBLIC + create :project, name: 'Community', visibility_level: Gitlab::VisibilityLevel::PUBLIC end step 'public empty project "Empty Public Project"' do - create :project, name: 'Empty Public Project', visibility_level: Gitlab::VisibilityLevel::PUBLIC + create :empty_project, name: 'Empty Public Project', visibility_level: Gitlab::VisibilityLevel::PUBLIC end step 'I visit empty project page' do - project = Project.find_by_name('Empty Public Project') + project = Project.find_by(name: 'Empty Public Project') visit project_path(project) end step 'I visit project "Community" page' do - project = Project.find_by_name('Community') + project = Project.find_by(name: 'Community') visit project_path(project) end @@ -47,14 +47,14 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'I should see empty public project details with http clone info' do - project = Project.find_by_name('Empty Public Project') + project = Project.find_by(name: 'Empty Public Project') page.all(:css, '.git-empty .clone').each do |element| element.text.should include(project.http_url_to_repo) end end step 'I should see empty public project details with ssh clone info' do - project = Project.find_by_name('Empty Public Project') + project = Project.find_by(name: 'Empty Public Project') page.all(:css, '.git-empty .clone').each do |element| element.text.should include(project.url_to_repo) end @@ -65,7 +65,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'I visit project "Enterprise" page' do - project = Project.find_by_name('Enterprise') + project = Project.find_by(name: 'Enterprise') visit project_path(project) end @@ -76,7 +76,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'internal project "Internal"' do - create :project_with_code, name: 'Internal', visibility_level: Gitlab::VisibilityLevel::INTERNAL + create :project, name: 'Internal', visibility_level: Gitlab::VisibilityLevel::INTERNAL end step 'I should see project "Internal"' do @@ -88,7 +88,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'I visit project "Internal" page' do - project = Project.find_by_name('Internal') + project = Project.find_by(name: 'Internal') visit project_path(project) end @@ -99,12 +99,12 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'I should see an http link to the repository' do - project = Project.find_by_name 'Community' + project = Project.find_by(name: 'Community') page.should have_field('project_clone', with: project.http_url_to_repo) end step 'I should see an ssh link to the repository' do - project = Project.find_by_name 'Community' + project = Project.find_by(name: 'Community') page.should have_field('project_clone', with: project.url_to_repo) end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 987cd3120c9..d287121bb84 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -241,7 +241,7 @@ module SharedPaths end step 'I visit issue page "Release 0.4"' do - issue = Issue.find_by_title("Release 0.4") + issue = Issue.find_by(title: "Release 0.4") visit project_issue_path(issue.project, issue) end @@ -250,12 +250,12 @@ module SharedPaths end step 'I visit merge request page "Bug NS-04"' do - mr = MergeRequest.find_by_title("Bug NS-04") + mr = MergeRequest.find_by(title: "Bug NS-04") visit project_merge_request_path(mr.target_project, mr) end step 'I visit merge request page "Bug NS-05"' do - mr = MergeRequest.find_by_title("Bug NS-05") + mr = MergeRequest.find_by(title: "Bug NS-05") visit project_merge_request_path(mr.target_project, mr) end @@ -292,7 +292,7 @@ module SharedPaths end step 'I visit public page for "Community" project' do - visit public_project_path(Project.find_by_name("Community")) + visit public_project_path(Project.find_by(name: "Community")) end # ---------------------------------------- @@ -316,6 +316,6 @@ module SharedPaths end def project - project = Project.find_by_name!("Shop") + project = Project.find_by!(name: "Shop") end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 3dc4932a09a..7360482d736 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -3,26 +3,26 @@ module SharedProject # Create a project without caring about what it's called And "I own a project" do - @project = create(:project_with_code, namespace: @user.namespace) + @project = create(:project, namespace: @user.namespace) @project.team << [@user, :master] end # Create a specific project called "Shop" And 'I own project "Shop"' do - @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop", namespace: @user.namespace) + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop", namespace: @user.namespace) @project.team << [@user, :master] end # Create another specific project called "Forum" And 'I own project "Forum"' do - @project = Project.find_by_name "Forum" - @project ||= create(:project_with_code, name: "Forum", namespace: @user.namespace, path: 'forum_project') + @project = Project.find_by(name: "Forum") + @project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project') @project.team << [@user, :master] end And 'project "Shop" has push event' do - @project = Project.find_by_name("Shop") + @project = Project.find_by(name: "Shop") data = { before: "0000000000000000000000000000000000000000", @@ -48,7 +48,7 @@ module SharedProject end Then 'I should see project "Shop" activity feed' do - project = Project.find_by_name("Shop") + project = Project.find_by(name: "Shop") page.should have_content "#{@user.name} pushed new branch new_design at #{project.name_with_namespace}" end diff --git a/features/steps/snippets/discover_snippets.rb b/features/steps/snippets/discover_snippets.rb index 3afe019adf6..09337937002 100644 --- a/features/steps/snippets/discover_snippets.rb +++ b/features/steps/snippets/discover_snippets.rb @@ -12,6 +12,6 @@ class DiscoverSnippets < Spinach::FeatureSteps end def snippet - @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") end end diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb index 1aea01f6cdf..fed54659ebc 100644 --- a/features/steps/snippets/snippets.rb +++ b/features/steps/snippets/snippets.rb @@ -59,6 +59,6 @@ class SnippetsFeature < Spinach::FeatureSteps end def snippet - @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") end end diff --git a/features/steps/snippets/user_snippets.rb b/features/steps/snippets/user_snippets.rb index 15d6da6db3d..2d7ffc866e7 100644 --- a/features/steps/snippets/user_snippets.rb +++ b/features/steps/snippets/user_snippets.rb @@ -36,6 +36,6 @@ class UserSnippets < Spinach::FeatureSteps end def snippet - @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") end end |