Commit 79eb5ab3 authored by Nihad Abbasov's avatar Nihad Abbasov

refactor feature steps

parent ef4e9c24
...@@ -4,7 +4,7 @@ Feature: Create Project ...@@ -4,7 +4,7 @@ Feature: Create Project
Should be able to create a new one Should be able to create a new one
Scenario: User create a project Scenario: User create a project
Given I signin as a user Given I sign in as a user
When I visit new project page When I visit new project page
And fill project form with valid data And fill project form with valid data
Then I should see project page Then I should see project page
......
@javascript
Feature: Project Wall Feature: Project Wall
In order to use Project Wall In order to use Project Wall
A user A user should be able to read and write messages
Should be able to read & write messages
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
And I visit project "Shop" wall page And I visit project "Shop" wall page
......
class Dashboard < Spinach::FeatureSteps class Dashboard < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
Then 'I should see "New Project" link' do Then 'I should see "New Project" link' do
page.should have_link "New Project" page.should have_link "New Project"
end end
...@@ -38,10 +41,6 @@ class Dashboard < Spinach::FeatureSteps ...@@ -38,10 +41,6 @@ class Dashboard < Spinach::FeatureSteps
) )
end end
When 'I visit dashboard page' do
visit dashboard_path
end
Then 'I should see "John Doe joined project Shop" event' do Then 'I should see "John Doe joined project Shop" event' do
page.should have_content "John Doe joined project Shop" page.should have_content "John Doe joined project Shop"
end end
...@@ -60,10 +59,6 @@ class Dashboard < Spinach::FeatureSteps ...@@ -60,10 +59,6 @@ class Dashboard < Spinach::FeatureSteps
page.should have_content "John Doe left project Shop" page.should have_content "John Doe left project Shop"
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Factory :project, :name => 'Shop' @project = Factory :project, :name => 'Shop'
@project.add_access(@user, :admin) @project.add_access(@user, :admin)
......
class DashboardIssues < Spinach::FeatureSteps class DashboardIssues < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
Then 'I should see issues assigned to me' do Then 'I should see issues assigned to me' do
issues = @user.issues issues = @user.issues
issues.each do |issue| issues.each do |issue|
...@@ -7,26 +10,10 @@ class DashboardIssues < Spinach::FeatureSteps ...@@ -7,26 +10,10 @@ class DashboardIssues < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I have assigned issues' do And 'I have assigned issues' do
project = Factory :project project = Factory :project
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
issue1 = Factory :issue, 2.times { Factory :issue, :author => @user, :assignee => @user, :project => project }
:author => @user,
:assignee => @user,
:project => project
issue2 = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
end
And 'I visit dashboard issues page' do
visit dashboard_issues_path
end end
end end
class DashboardMergeRequests < Spinach::FeatureSteps class DashboardMergeRequests < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
Then 'I should see my merge requests' do Then 'I should see my merge requests' do
merge_requests = @user.merge_requests merge_requests = @user.merge_requests
merge_requests.each do |mr| merge_requests.each do |mr|
...@@ -7,10 +10,6 @@ class DashboardMergeRequests < Spinach::FeatureSteps ...@@ -7,10 +10,6 @@ class DashboardMergeRequests < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I have authored merge requests' do And 'I have authored merge requests' do
project1 = Factory :project project1 = Factory :project
project2 = Factory :project project2 = Factory :project
...@@ -18,16 +17,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps ...@@ -18,16 +17,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps
project1.add_access(@user, :read, :write) project1.add_access(@user, :read, :write)
project2.add_access(@user, :read, :write) project2.add_access(@user, :read, :write)
merge_request1 = Factory :merge_request, merge_request1 = Factory :merge_request, :author => @user, :project => project1
:author => @user, merge_request2 = Factory :merge_request, :author => @user, :project => project2
:project => project1
merge_request2 = Factory :merge_request,
:author => @user,
:project => project2
end
And 'I visit dashboard merge requests page' do
visit dashboard_merge_requests_path
end end
end end
class DashboardSearch < Spinach::FeatureSteps class DashboardSearch < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
Given 'I search for "Sho"' do Given 'I search for "Sho"' do
fill_in "dashboard_search", :with => "Sho" fill_in "dashboard_search", :with => "Sho"
click_button "Search" click_button "Search"
...@@ -8,16 +11,8 @@ class DashboardSearch < Spinach::FeatureSteps ...@@ -8,16 +11,8 @@ class DashboardSearch < Spinach::FeatureSteps
page.should have_link "Shop" page.should have_link "Shop"
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop" @project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin) @project.add_access(@user, :admin)
end end
And 'I visit dashboard search page' do
visit search_path
end
end end
class Profile < Spinach::FeatureSteps class Profile < Spinach::FeatureSteps
Given 'I visit profile page' do include SharedAuthentication
visit profile_path include SharedPaths
end
Then 'I should see my profile info' do Then 'I should see my profile info' do
page.should have_content "Profile" page.should have_content "Profile"
...@@ -23,10 +22,6 @@ class Profile < Spinach::FeatureSteps ...@@ -23,10 +22,6 @@ class Profile < Spinach::FeatureSteps
@user.twitter.should == 'testtwitter' @user.twitter.should == 'testtwitter'
end end
Given 'I visit profile password page' do
visit profile_password_path
end
Then 'I change my password' do Then 'I change my password' do
fill_in "user_password", :with => "222333" fill_in "user_password", :with => "222333"
fill_in "user_password_confirmation", :with => "222333" fill_in "user_password_confirmation", :with => "222333"
...@@ -37,10 +32,6 @@ class Profile < Spinach::FeatureSteps ...@@ -37,10 +32,6 @@ class Profile < Spinach::FeatureSteps
current_path.should == new_user_session_path current_path.should == new_user_session_path
end end
Given 'I visit profile token page' do
visit profile_token_path
end
Then 'I reset my token' do Then 'I reset my token' do
@old_token = @user.private_token @old_token = @user.private_token
click_button "Reset" click_button "Reset"
...@@ -50,8 +41,4 @@ class Profile < Spinach::FeatureSteps ...@@ -50,8 +41,4 @@ class Profile < Spinach::FeatureSteps
find("#token").value.should_not == @old_token find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token find("#token").value.should == @user.reload.private_token
end end
Given 'I sign in as a user' do
login_as :user
end
end end
class ProfileSshKeys < Spinach::FeatureSteps class ProfileSshKeys < Spinach::FeatureSteps
include SharedAuthentication
Then 'I should see my ssh keys' do Then 'I should see my ssh keys' do
@user.keys.each do |key| @user.keys.each do |key|
page.should have_content(key.title) page.should have_content(key.title)
...@@ -40,10 +42,6 @@ class ProfileSshKeys < Spinach::FeatureSteps ...@@ -40,10 +42,6 @@ class ProfileSshKeys < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I have ssh key "ssh-rsa Work"' do And 'I have ssh key "ssh-rsa Work"' do
Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work" Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work"
end end
......
class CreateProject < Spinach::FeatureSteps class CreateProject < Spinach::FeatureSteps
Given 'I signin as a user' do include SharedAuthentication
login_as :user include SharedPaths
end
When 'I visit new project page' do
visit new_project_path
end
And 'fill project form with valid data' do And 'fill project form with valid data' do
fill_in 'project_name', :with => 'NewProject' fill_in 'project_name', :with => 'NewProject'
...@@ -16,7 +11,7 @@ class CreateProject < Spinach::FeatureSteps ...@@ -16,7 +11,7 @@ class CreateProject < Spinach::FeatureSteps
Then 'I should see project page' do Then 'I should see project page' do
current_path.should == project_path(Project.last) current_path.should == project_path(Project.last)
page.should have_content('NewProject') page.should have_content "NewProject"
end end
And 'I should see empty project instuctions' do And 'I should see empty project instuctions' do
......
class Projects < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
end
class ProjectBrowseBranches < Spinach::FeatureSteps class ProjectBrowseBranches < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should see "Shop" recent branches list' do Then 'I should see "Shop" recent branches list' do
page.should have_content "Branches" page.should have_content "Branches"
page.should have_content "master" page.should have_content "master"
...@@ -24,21 +28,8 @@ class ProjectBrowseBranches < Spinach::FeatureSteps ...@@ -24,21 +28,8 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" has protected branches' do 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") project.protected_branches.create(:name => "stable")
end end
Given 'I visit project branches page' do
visit branches_project_repository_path(@project)
end
end end
class ProjectBrowseCommits < Spinach::FeatureSteps class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I see project commits' do Then 'I see project commits' do
current_path.should == project_commits_path(@project) current_path.should == project_commits_path(@project)
...@@ -29,10 +33,6 @@ class ProjectBrowseCommits < Spinach::FeatureSteps ...@@ -29,10 +33,6 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.should have_content "Showing 1 changed file" page.should have_content "Showing 1 changed file"
end end
Given 'I visit compare refs page' do
visit compare_project_commits_path(@project)
end
And 'I fill compare fields with refs' do And 'I fill compare fields with refs' do
fill_in "from", :with => "master" fill_in "from", :with => "master"
fill_in "to", :with => "stable" fill_in "to", :with => "stable"
...@@ -44,17 +44,4 @@ class ProjectBrowseCommits < Spinach::FeatureSteps ...@@ -44,17 +44,4 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.should have_content "Compare View" page.should have_content "Compare View"
page.should have_content "Showing 73 changed files" page.should have_content "Showing 73 changed files"
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project commits page' do
visit project_commits_path(@project)
end
end end
class ProjectBrowseFiles < Spinach::FeatureSteps class ProjectBrowseFiles < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should see files from repository' do Then 'I should see files from repository' do
page.should have_content "app" page.should have_content "app"
page.should have_content "History" page.should have_content "History"
page.should have_content "Gemfile" page.should have_content "Gemfile"
end end
Given 'I visit project source page for "8470d70"' do
visit tree_project_ref_path(@project, "8470d70")
end
Then 'I should see files from repository for "8470d70"' do Then 'I should see files from repository for "8470d70"' do
current_path.should == tree_project_ref_path(@project, "8470d70") current_path.should == tree_project_ref_path(@project, "8470d70")
page.should have_content "app" page.should have_content "app"
...@@ -24,10 +24,6 @@ class ProjectBrowseFiles < Spinach::FeatureSteps ...@@ -24,10 +24,6 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
page.should have_content "rubygems.org" page.should have_content "rubygems.org"
end end
Given 'I visit blob file from repo' do
visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
end
And 'I click link "raw"' do And 'I click link "raw"' do
click_link "raw" click_link "raw"
end end
...@@ -35,17 +31,4 @@ class ProjectBrowseFiles < Spinach::FeatureSteps ...@@ -35,17 +31,4 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
Then 'I should see raw file content' do Then 'I should see raw file content' do
page.source.should == ValidCommit::BLOB_FILE page.source.should == ValidCommit::BLOB_FILE
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project source page' do
visit tree_project_ref_path(@project, @project.root_ref)
end
end end
class ProjectBrowseGitRepo < Spinach::FeatureSteps class ProjectBrowseGitRepo < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Given 'I click on "Gemfile" file in repo' do Given 'I click on "Gemfile" file in repo' do
click_link "Gemfile" click_link "Gemfile"
end end
...@@ -12,17 +16,4 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps ...@@ -12,17 +16,4 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps
page.should have_content "Dmitriy Zaporozhets" page.should have_content "Dmitriy Zaporozhets"
page.should have_content "bc3735004cb Moving to rails 3.2" page.should have_content "bc3735004cb Moving to rails 3.2"
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project source page' do
visit tree_project_ref_path(@project, @project.root_ref)
end
end end
class ProjectBrowseTags < Spinach::FeatureSteps class ProjectBrowseTags < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should see "Shop" all tags list' do Then 'I should see "Shop" all tags list' do
page.should have_content "Tags" page.should have_content "Tags"
page.should have_content "v1.2.1" page.should have_content "v1.2.1"
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project tags page' do
visit tags_project_repository_path(@project)
end
end end
class ProjectCommentCommit < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedNote
include SharedPaths
end
class ProjectIssues < Spinach::FeatureSteps class ProjectIssues < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedNote
include SharedPaths
Given 'I should see "Release 0.4" in issues' do Given 'I should see "Release 0.4" in issues' do
page.should have_content "Release 0.4" page.should have_content "Release 0.4"
end end
...@@ -51,20 +56,6 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -51,20 +56,6 @@ class ProjectIssues < Spinach::FeatureSteps
page.should have_content issue.project.name page.should have_content issue.project.name
end end
Given 'I visit issue page "Release 0.4"' do
issue = Issue.find_by_title("Release 0.4")
visit project_issue_path(issue.project, issue)
end
And 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I fill in issue search with "Release"' do Given 'I fill in issue search with "Release"' do
fill_in 'issue_search', with: "Release" fill_in 'issue_search', with: "Release"
end end
...@@ -90,22 +81,14 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -90,22 +81,14 @@ class ProjectIssues < Spinach::FeatureSteps
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
milestone = Factory :milestone, :title => "v2.2", :project => project milestone = Factory :milestone, :title => "v2.2", :project => project
3.times do 3.times { Factory :issue, :project => project, :milestone => milestone }
issue = Factory :issue, :project => project, :milestone => milestone
end
end end
And 'project "Shop" has milestone "v3.0"' do And 'project "Shop" has milestone "v3.0"' do
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
milestone = Factory :milestone, :title => "v3.0", :project => project milestone = Factory :milestone, :title => "v3.0", :project => project
3.times do 3.times { Factory :issue, :project => project, :milestone => milestone }
issue = Factory :issue, :project => project, :milestone => milestone
end
end
And 'I visit project "Shop" issues page' do
visit project_issues_path(Project.find_by_name("Shop"))
end end
When 'I select milestone "v3.0"' do When 'I select milestone "v3.0"' do
...@@ -132,15 +115,6 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -132,15 +115,6 @@ class ProjectIssues < Spinach::FeatureSteps
page.find(issues_assignee_selector).should have_content(assignee_name) page.find(issues_assignee_selector).should have_content(assignee_name)
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" have "Release 0.4" open issue' do And 'project "Shop" have "Release 0.4" open issue' do
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
Factory.create(:issue, Factory.create(:issue,
......
class ProjectLabels < Spinach::FeatureSteps class ProjectLabels < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should see label "bug"' do Then 'I should see label "bug"' do
within ".labels-table" do within ".labels-table" do
page.should have_content "bug" page.should have_content "bug"
...@@ -11,23 +15,10 @@ class ProjectLabels < Spinach::FeatureSteps ...@@ -11,23 +15,10 @@ class ProjectLabels < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" have issues tags: "bug", "feature"' do 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| ['bug', 'feature'].each do |label|
Factory :issue, project: project, label_list: label Factory :issue, project: project, label_list: label
end end
end end
Given 'I visit project "Shop" labels page' do
visit project_labels_path(Project.find_by_name("Shop"))
end
end end
class ProjectMergeRequests < Spinach::FeatureSteps class ProjectMergeRequests < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedNote
include SharedPaths
Then 'I should see "Bug NS-04" in merge requests' do Then 'I should see "Bug NS-04" in merge requests' do
page.should have_content "Bug NS-04" page.should have_content "Bug NS-04"
end end
...@@ -56,29 +61,6 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -56,29 +61,6 @@ class ProjectMergeRequests < Spinach::FeatureSteps
page.should have_content "Wiki Feature" page.should have_content "Wiki Feature"
end end
Given 'I visit merge request page "Bug NS-04"' do
mr = MergeRequest.find_by_title("Bug NS-04")
visit project_merge_request_path(mr.project, mr)
end
And 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" have "Bug NS-04" open merge request' do And 'project "Shop" have "Bug NS-04" open merge request' do
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
Factory.create(:merge_request, Factory.create(:merge_request,
...@@ -95,8 +77,4 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -95,8 +77,4 @@ class ProjectMergeRequests < Spinach::FeatureSteps
:author => project.users.first, :author => project.users.first,
:closed => true) :closed => true)
end end
And 'I visit project "Shop" merge requests page' do
visit project_merge_requests_path(Project.find_by_name("Shop"))
end
end end
class ProjectMilestones < Spinach::FeatureSteps class ProjectMilestones < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should see milestone "v2.2"' do 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.title[0..10])
...@@ -26,26 +30,10 @@ class ProjectMilestones < Spinach::FeatureSteps ...@@ -26,26 +30,10 @@ class ProjectMilestones < Spinach::FeatureSteps
page.should have_content("Browse Issues") page.should have_content("Browse Issues")
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" has milestone "v2.2"' do And 'project "Shop" has milestone "v2.2"' do
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
milestone = Factory :milestone, :title => "v2.2", :project => project milestone = Factory :milestone, :title => "v2.2", :project => project
3.times do 3.times { Factory :issue, :project => project, :milestone => milestone }
issue = Factory :issue, :project => project, :milestone => milestone
end
end
Given 'I visit project "Shop" milestones page' do
@project = Project.find_by_name("Shop")
visit project_milestones_path(@project)
end end
end end
class ProjectNetworkGraph < Spinach::FeatureSteps class ProjectNetworkGraph < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
Then 'page should have network graph' do Then 'page should have network graph' do
page.should have_content "Project Network Graph" page.should have_content "Project Network Graph"
within ".graph" do within ".graph" do
...@@ -7,15 +10,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -7,15 +10,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end end
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'I visit project "Shop" network page' do And 'I visit project "Shop" network page' do
project = Project.find_by_name("Shop") project = Project.find_by_name("Shop")
......
class ProjectTeamManagement < Spinach::FeatureSteps class ProjectTeamManagement < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
Then 'I should be able to see myself in team' do Then 'I should be able to see myself in team' do
page.should have_content(@user.name) page.should have_content(@user.name)
page.should have_content(@user.email) page.should have_content(@user.email)
...@@ -42,10 +46,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -42,10 +46,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps
end end
end end
Then 'I visit project "Shop" team page' do
visit team_project_path(Project.find_by_name("Shop"))
end
And 'I should see "Sam" in team list as "Reporter"' do And 'I should see "Sam" in team list as "Reporter"' do
user = User.find_by_name("Sam") user = User.find_by_name("Sam")
role_id = find(".user_#{user.id} #team_member_project_access").value role_id = find(".user_#{user.id} #team_member_project_access").value
...@@ -73,15 +73,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -73,15 +73,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps
page.should_not have_content(user.email) page.should_not have_content(user.email)
end end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'gitlab user "Mike"' do And 'gitlab user "Mike"' do
Factory :user, :name => "Mike" Factory :user, :name => "Mike"
end end
......
class ProjectWall < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedNote
include SharedPaths
end
class ProjectWiki < Spinach::FeatureSteps class ProjectWiki < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedNote
include SharedPaths
Given 'I create Wiki page' do Given 'I create Wiki page' do
fill_in "Title", :with => 'Test title' fill_in "Title", :with => 'Test title'
fill_in "Content", :with => '[link test](test)' fill_in "Content", :with => '[link test](test)'
...@@ -12,26 +17,4 @@ class ProjectWiki < Spinach::FeatureSteps ...@@ -12,26 +17,4 @@ class ProjectWiki < Spinach::FeatureSteps
click_link "link test" click_link "link test"
page.should have_content "Editing page" page.should have_content "Editing page"
end end
And 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project wiki page' do
visit project_wiki_path(@project, :index)
end
end end
class ProjectCommentCommit < Spinach::FeatureSteps
Given 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project commit page' do
visit project_commit_path(@project, ValidCommit::ID)
end
end
require Rails.root.join('spec', 'support', 'login_helpers')
module SharedAuthentication
include Spinach::DSL
include LoginHelpers
Given 'I sign in as a user' do
login_as :user
end
end
class ProjectWall < Spinach::FeatureSteps module SharedNote
Given 'I write new comment "my special test message"' do include Spinach::DSL
fill_in "note_note", :with => "my special test message"
click_button "Add Comment"
end
Then 'I should see project wall note "my special test message"' do Given 'I leave a comment like "XML attached"' do
page.should have_content "my special test message" fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end end
Then 'I visit project "Shop" wall page' do Then 'I should see comment "XML attached"' do
project = Project.find_by_name("Shop") page.should have_content "XML attached"
visit wall_project_path(project)
end end
Given 'I signin as a user' do Given 'I write new comment "my special test message"' do
login_as :user fill_in "note_note", :with => "my special test message"
click_button "Add Comment"
end end
And 'I own project "Shop"' do Then 'I should see project wall note "my special test message"' do
@project = Factory :project, :name => "Shop" page.should have_content "my special test message"
@project.add_access(@user, :admin)
end end
end end
module SharedPaths
include Spinach::DSL
And 'I visit dashboard search page' do
visit search_path
end
And 'I visit dashboard merge requests page' do
visit dashboard_merge_requests_path
end
And 'I visit dashboard issues page' do
visit dashboard_issues_path
end
When 'I visit dashboard page' do
visit dashboard_path
end
Given 'I visit profile page' do
visit profile_path
end
Given 'I visit profile password page' do
visit profile_password_path
end
Given 'I visit profile token page' do
visit profile_token_path
end
When 'I visit new project page' do
visit new_project_path
end
And 'I visit project "Shop" page' do
project = Project.find_by_name("Shop")
visit project_path(project)
end
Given 'I visit project branches page' do
visit branches_project_repository_path(@project)
end
Given 'I visit compare refs page' do
visit compare_project_commits_path(@project)
end
Given 'I visit project commits page' do
visit project_commits_path(@project)
end
Given 'I visit project source page' do
visit tree_project_ref_path(@project, @project.root_ref)
end
Given 'I visit blob file from repo' do
visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
end
Given 'I visit project source page for "8470d70"' do
visit tree_project_ref_path(@project, "8470d70")
end
Given 'I visit project tags page' do
visit tags_project_repository_path(@project)
end
Given 'I visit project commit page' do
visit project_commit_path(@project, ValidCommit::ID)
end
And 'I visit project "Shop" issues page' do
visit project_issues_path(Project.find_by_name("Shop"))
end
Given 'I visit issue page "Release 0.4"' do
issue = Issue.find_by_title("Release 0.4")
visit project_issue_path(issue.project, issue)
end
Given 'I visit project "Shop" labels page' do
visit project_labels_path(Project.find_by_name("Shop"))
end
Given 'I visit merge request page "Bug NS-04"' do
mr = MergeRequest.find_by_title("Bug NS-04")
visit project_merge_request_path(mr.project, mr)
end
And 'I visit project "Shop" merge requests page' do
visit project_merge_requests_path(Project.find_by_name("Shop"))
end
Given 'I visit project "Shop" milestones page' do
@project = Project.find_by_name("Shop")
visit project_milestones_path(@project)
end
Then 'I visit project "Shop" team page' do
visit team_project_path(Project.find_by_name("Shop"))
end
Then 'I visit project "Shop" wall page' do
project = Project.find_by_name("Shop")
visit wall_project_path(project)
end
Given 'I visit project wiki page' do
visit project_wiki_path(@project, :index)
end
end
class Projects < Spinach::FeatureSteps module SharedProject
Given 'I sign in as a user' do include Spinach::DSL
login_as :user
end
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop" @project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin) @project.add_access(@user, :admin)
end end
And 'I visit project "Shop" page' do
project = Project.find_by_name("Shop")
visit project_path(project)
end
end end
...@@ -5,11 +5,12 @@ require 'rspec' ...@@ -5,11 +5,12 @@ require 'rspec'
require 'database_cleaner' require 'database_cleaner'
require 'spinach/capybara' require 'spinach/capybara'
%w(gitolite_stub login_helpers stubbed_repository valid_commit).each do |f| %w(gitolite_stub stubbed_repository valid_commit).each do |f|
require Rails.root.join('spec', 'support', f) require Rails.root.join('spec', 'support', f)
end end
include LoginHelpers Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}
include GitoliteStub include GitoliteStub
WebMock.allow_net_connect! WebMock.allow_net_connect!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment