diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-02-03 16:59:20 +0400 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-02-03 16:59:20 +0400 |
commit | 70fb26a6b7091aee9875970f070a6801e35de764 (patch) | |
tree | de0a1be366a3274380411903f7ab8000e19973c1 /features | |
parent | 75cecf36e0d60bd4ca1dce0997745268b49eaee5 (diff) |
Extract projects and mr into methods in features.
Diffstat (limited to 'features')
-rw-r--r-- | features/public/public_projects.feature | 3 | ||||
-rw-r--r-- | features/steps/public/projects_feature.rb | 93 |
2 files changed, 45 insertions, 51 deletions
diff --git a/features/public/public_projects.feature b/features/public/public_projects.feature index fae7789b9ff..57fe834b4bf 100644 --- a/features/public/public_projects.feature +++ b/features/public/public_projects.feature @@ -84,15 +84,18 @@ Feature: Public Projects Feature Given I sign in as a user Given I visit project "Community" page And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request Then I should see list of merge requests for "Community" project Scenario: I visit public project merge requests page as a non authorized user Given I visit project "Community" page And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request Then I should see list of merge requests for "Community" project Scenario: I visit internal project merge requests page as an authorized user Given I sign in as a user Given I visit project "Internal" page And I visit "Internal" merge requests page + And project "Internal" has "Feature implemented" open merge request Then I should see list of merge requests for "Internal" project diff --git a/features/steps/public/projects_feature.rb b/features/steps/public/projects_feature.rb index e0a26402275..84a5ebbf7a7 100644 --- a/features/steps/public/projects_feature.rb +++ b/features/steps/public/projects_feature.rb @@ -109,101 +109,92 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps end step 'I visit "Community" issues page' do - project = Project.find_by(name: 'Community') create(:issue, title: "Bug", - project: project + project: public_project ) create(:issue, title: "New feature", - project: project + project: public_project ) - visit project_issues_path(project) + visit project_issues_path(public_project) end step 'I should see list of issues for "Community" project' do - project = Project.find_by(name: 'Community') - page.should have_content "Bug" - page.should have_content project.name + page.should have_content public_project.name page.should have_content "New feature" end step 'I visit "Internal" issues page' do - project = Project.find_by(name: 'Internal') create(:issue, title: "Internal Bug", - project: project + project: internal_project ) create(:issue, title: "New internal feature", - project: project + project: internal_project ) - visit project_issues_path(project) + visit project_issues_path(internal_project) end step 'I should see list of issues for "Internal" project' do - project = Project.find_by(name: 'Internal') - page.should have_content "Internal Bug" - page.should have_content project.name + page.should have_content internal_project.name page.should have_content "New internal feature" end step 'I visit "Community" merge requests page' do - project = Project.find_by(name: 'Community') - create(:merge_request, - title: "Bug fix", - source_project: project, - target_project: project, - source_branch: 'stable', - target_branch: 'master', - ) + visit project_merge_requests_path(public_project) + end + + step 'project "Community" has "Bug fix" open merge request' do create(:merge_request, - title: "Feature created", - source_project: project, - target_project: project, - source_branch: 'stable', - target_branch: 'master', + title: "Bug fix for public project", + source_project: public_project, + target_project: public_project, ) - visit project_merge_requests_path(project) end step 'I should see list of merge requests for "Community" project' do - project = Project.find_by(name: 'Community') - - page.should have_content "Bug fix" - page.should have_content project.name - page.should have_content "Feature created" + page.should have_content public_project.name + page.should have_content public_merge_request.source_project.name end step 'I visit "Internal" merge requests page' do - project = Project.find_by(name: 'Internal') - create(:merge_request, - title: "Bug fix internal", - source_project: project, - target_project: project, - source_branch: 'stable', - target_branch: 'master', - ) + visit project_merge_requests_path(internal_project) + end + + step 'project "Internal" has "Feature implemented" open merge request' do create(:merge_request, - title: "Feature created for internal", - source_project: project, - target_project: project, - source_branch: 'stable', - target_branch: 'master', + title: "Feature implemented", + source_project: internal_project, + target_project: internal_project ) - visit project_merge_requests_path(project) end step 'I should see list of merge requests for "Internal" project' do - project = Project.find_by(name: 'Internal') + page.should have_content internal_project.name + page.should have_content internal_merge_request.source_project.name + end + + def internal_project + @internal_project ||= Project.find_by!(name: 'Internal') + end + + def public_project + @public_project ||= Project.find_by!(name: 'Community') + end + + + def internal_merge_request + @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented') + end - page.should have_content "Bug fix internal" - page.should have_content project.name - page.should have_content "Feature created for internal" + def public_merge_request + @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') end end |