refactor feature steps
This commit is contained in:
parent
ef4e9c24d3
commit
79eb5ab396
34 changed files with 270 additions and 376 deletions
92
features/steps/dashboard/dashboard.rb
Normal file
92
features/steps/dashboard/dashboard.rb
Normal file
|
@ -0,0 +1,92 @@
|
|||
class Dashboard < Spinach::FeatureSteps
|
||||
include SharedAuthentication
|
||||
include SharedPaths
|
||||
|
||||
Then 'I should see "New Project" link' do
|
||||
page.should have_link "New Project"
|
||||
end
|
||||
|
||||
Then 'I should see "Shop" project link' do
|
||||
page.should have_link "Shop"
|
||||
end
|
||||
|
||||
Then 'I should see project "Shop" activity feed' do
|
||||
project = Project.find_by_name("Shop")
|
||||
page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
|
||||
end
|
||||
|
||||
Then 'I should see last push widget' do
|
||||
page.should have_content "Your pushed to branch new_design"
|
||||
page.should have_link "Create Merge Request"
|
||||
end
|
||||
|
||||
And 'I click "Create Merge Request" link' do
|
||||
click_link "Create Merge Request"
|
||||
end
|
||||
|
||||
Then 'I see prefilled new Merge Request page' do
|
||||
current_path.should == new_project_merge_request_path(@project)
|
||||
find("#merge_request_source_branch").value.should == "new_design"
|
||||
find("#merge_request_target_branch").value.should == "master"
|
||||
find("#merge_request_title").value.should == "New Design"
|
||||
end
|
||||
|
||||
Given 'user with name "John Doe" joined project "Shop"' do
|
||||
user = Factory.create(:user, {name: "John Doe"})
|
||||
project = Project.find_by_name "Shop"
|
||||
Event.create(
|
||||
project: project,
|
||||
author_id: user.id,
|
||||
action: Event::Joined
|
||||
)
|
||||
end
|
||||
|
||||
Then 'I should see "John Doe joined project Shop" event' do
|
||||
page.should have_content "John Doe joined project Shop"
|
||||
end
|
||||
|
||||
And 'user with name "John Doe" left project "Shop"' do
|
||||
user = User.find_by_name "John Doe"
|
||||
project = Project.find_by_name "Shop"
|
||||
Event.create(
|
||||
project: project,
|
||||
author_id: user.id,
|
||||
action: Event::Left
|
||||
)
|
||||
end
|
||||
|
||||
Then 'I should see "John Doe left project Shop" event' do
|
||||
page.should have_content "John Doe left project Shop"
|
||||
end
|
||||
|
||||
And 'I own project "Shop"' do
|
||||
@project = Factory :project, :name => 'Shop'
|
||||
@project.add_access(@user, :admin)
|
||||
end
|
||||
|
||||
And 'project "Shop" has push event' do
|
||||
@project = Project.find_by_name("Shop")
|
||||
|
||||
data = {
|
||||
:before => "0000000000000000000000000000000000000000",
|
||||
:after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
|
||||
:ref => "refs/heads/new_design",
|
||||
:user_id => @user.id,
|
||||
:user_name => @user.name,
|
||||
:repository => {
|
||||
:name => @project.name,
|
||||
:url => "localhost/rubinius",
|
||||
:description => "",
|
||||
:homepage => "localhost/rubinius",
|
||||
:private => true
|
||||
}
|
||||
}
|
||||
|
||||
@event = Event.create(
|
||||
:project => @project,
|
||||
:action => Event::Pushed,
|
||||
:data => data,
|
||||
:author_id => @user.id
|
||||
)
|
||||
end
|
||||
end
|
19
features/steps/dashboard/dashboard_issues.rb
Normal file
19
features/steps/dashboard/dashboard_issues.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class DashboardIssues < Spinach::FeatureSteps
|
||||
include SharedAuthentication
|
||||
include SharedPaths
|
||||
|
||||
Then 'I should see issues assigned to me' do
|
||||
issues = @user.issues
|
||||
issues.each do |issue|
|
||||
page.should have_content(issue.title[0..10])
|
||||
page.should have_content(issue.project.name)
|
||||
end
|
||||
end
|
||||
|
||||
And 'I have assigned issues' do
|
||||
project = Factory :project
|
||||
project.add_access(@user, :read, :write)
|
||||
|
||||
2.times { Factory :issue, :author => @user, :assignee => @user, :project => project }
|
||||
end
|
||||
end
|
23
features/steps/dashboard/dashboard_merge_requests.rb
Normal file
23
features/steps/dashboard/dashboard_merge_requests.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
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|
|
||||
page.should have_content(mr.title[0..10])
|
||||
page.should have_content(mr.project.name)
|
||||
end
|
||||
end
|
||||
|
||||
And 'I have authored merge requests' do
|
||||
project1 = Factory :project
|
||||
project2 = Factory :project
|
||||
|
||||
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
|
||||
end
|
18
features/steps/dashboard/dashboard_search.rb
Normal file
18
features/steps/dashboard/dashboard_search.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class DashboardSearch < Spinach::FeatureSteps
|
||||
include SharedAuthentication
|
||||
include SharedPaths
|
||||
|
||||
Given 'I search for "Sho"' do
|
||||
fill_in "dashboard_search", :with => "Sho"
|
||||
click_button "Search"
|
||||
end
|
||||
|
||||
Then 'I should see "Shop" project link' do
|
||||
page.should have_link "Shop"
|
||||
end
|
||||
|
||||
And 'I own project "Shop"' do
|
||||
@project = Factory :project, :name => "Shop"
|
||||
@project.add_access(@user, :admin)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue