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