Dashboard steps: 1.9 syntax & use of create instead of Factory

This commit is contained in:
Dmitriy Zaporozhets 2012-11-07 13:56:48 +02:00
parent 8114d36caf
commit 22d0569dbb
4 changed files with 33 additions and 34 deletions

View file

@ -32,7 +32,7 @@ class Dashboard < Spinach::FeatureSteps
end
Given 'user with name "John Doe" joined project "Shop"' do
user = Factory.create(:user, {name: "John Doe"})
user = create :user, {name: "John Doe"}
project = Project.find_by_name "Shop"
Event.create(
project: project,
@ -60,14 +60,14 @@ class Dashboard < Spinach::FeatureSteps
end
And 'I own project "Shop"' do
@project = Factory :project, :name => 'Shop'
@project = create :project, name: 'Shop'
@project.add_access(@user, :admin)
end
And 'I have group with projects' do
@group = Factory :group
@project = Factory :project, group: @group
@event = Factory :closed_issue_event, project: @project
@group = create :group
@project = create :project, group: @group
@event = create :closed_issue_event, project: @project
@project.add_access current_user, :admin
end
@ -76,25 +76,25 @@ class Dashboard < Spinach::FeatureSteps
@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
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
project: @project,
action: Event::Pushed,
data: data,
author_id: @user.id
)
end

View file

@ -11,9 +11,9 @@ class DashboardIssues < Spinach::FeatureSteps
end
And 'I have assigned issues' do
project = Factory :project
project = create :project
project.add_access(@user, :read, :write)
2.times { Factory :issue, :author => @user, :assignee => @user, :project => project }
2.times { create :issue, author: @user, assignee: @user, project: project }
end
end

View file

@ -11,13 +11,13 @@ class DashboardMergeRequests < Spinach::FeatureSteps
end
And 'I have authored merge requests' do
project1 = Factory :project
project2 = Factory :project
project1 = create :project
project2 = create :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
merge_request1 = create :merge_request, author: @user, project: project1
merge_request2 = create :merge_request, author: @user, project: project2
end
end

View file

@ -3,7 +3,7 @@ class DashboardSearch < Spinach::FeatureSteps
include SharedPaths
Given 'I search for "Sho"' do
fill_in "dashboard_search", :with => "Sho"
fill_in "dashboard_search", with: "Sho"
click_button "Search"
end
@ -12,24 +12,23 @@ class DashboardSearch < Spinach::FeatureSteps
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project = create :project, name: "Shop"
@project.add_access(@user, :admin)
end
Given 'I search for "Contibuting"' do
fill_in "dashboard_search", :with => "Contibuting"
fill_in "dashboard_search", with: "Contibuting"
click_button "Search"
end
And 'Project "Shop" has wiki page "Contibuting guide"' do
@wiki_page = Factory :wiki, :project => @project,
:title => "Contibuting guide",
:slug => "contributing"
@wiki_page = create :wiki,
project: @project,
title: "Contibuting guide",
slug: "contributing"
end
Then 'I should see "Contibuting guide" wiki link' do
page.should have_link "Contibuting guide"
end
end