Commit 22d0569d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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

parent 8114d36c
...@@ -32,7 +32,7 @@ class Dashboard < Spinach::FeatureSteps ...@@ -32,7 +32,7 @@ class Dashboard < Spinach::FeatureSteps
end end
Given 'user with name "John Doe" joined project "Shop"' do 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" project = Project.find_by_name "Shop"
Event.create( Event.create(
project: project, project: project,
...@@ -60,14 +60,14 @@ class Dashboard < Spinach::FeatureSteps ...@@ -60,14 +60,14 @@ class Dashboard < Spinach::FeatureSteps
end end
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Factory :project, :name => 'Shop' @project = create :project, name: 'Shop'
@project.add_access(@user, :admin) @project.add_access(@user, :admin)
end end
And 'I have group with projects' do And 'I have group with projects' do
@group = Factory :group @group = create :group
@project = Factory :project, group: @group @project = create :project, group: @group
@event = Factory :closed_issue_event, project: @project @event = create :closed_issue_event, project: @project
@project.add_access current_user, :admin @project.add_access current_user, :admin
end end
...@@ -76,25 +76,25 @@ class Dashboard < Spinach::FeatureSteps ...@@ -76,25 +76,25 @@ class Dashboard < Spinach::FeatureSteps
@project = Project.find_by_name("Shop") @project = Project.find_by_name("Shop")
data = { data = {
:before => "0000000000000000000000000000000000000000", before: "0000000000000000000000000000000000000000",
:after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
:ref => "refs/heads/new_design", ref: "refs/heads/new_design",
:user_id => @user.id, user_id: @user.id,
:user_name => @user.name, user_name: @user.name,
:repository => { repository: {
:name => @project.name, name: @project.name,
:url => "localhost/rubinius", url: "localhost/rubinius",
:description => "", description: "",
:homepage => "localhost/rubinius", homepage: "localhost/rubinius",
:private => true private: true
} }
} }
@event = Event.create( @event = Event.create(
:project => @project, project: @project,
:action => Event::Pushed, action: Event::Pushed,
:data => data, data: data,
:author_id => @user.id author_id: @user.id
) )
end end
......
...@@ -11,9 +11,9 @@ class DashboardIssues < Spinach::FeatureSteps ...@@ -11,9 +11,9 @@ class DashboardIssues < Spinach::FeatureSteps
end end
And 'I have assigned issues' do And 'I have assigned issues' do
project = Factory :project project = create :project
project.add_access(@user, :read, :write) 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
end end
...@@ -11,13 +11,13 @@ class DashboardMergeRequests < Spinach::FeatureSteps ...@@ -11,13 +11,13 @@ class DashboardMergeRequests < Spinach::FeatureSteps
end end
And 'I have authored merge requests' do And 'I have authored merge requests' do
project1 = Factory :project project1 = create :project
project2 = Factory :project project2 = create :project
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, :author => @user, :project => project1 merge_request1 = create :merge_request, author: @user, project: project1
merge_request2 = Factory :merge_request, :author => @user, :project => project2 merge_request2 = create :merge_request, author: @user, project: project2
end end
end end
...@@ -3,7 +3,7 @@ class DashboardSearch < Spinach::FeatureSteps ...@@ -3,7 +3,7 @@ class DashboardSearch < Spinach::FeatureSteps
include SharedPaths 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"
end end
...@@ -12,24 +12,23 @@ class DashboardSearch < Spinach::FeatureSteps ...@@ -12,24 +12,23 @@ class DashboardSearch < Spinach::FeatureSteps
end end
And 'I own project "Shop"' do And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop" @project = create :project, name: "Shop"
@project.add_access(@user, :admin) @project.add_access(@user, :admin)
end end
Given 'I search for "Contibuting"' do Given 'I search for "Contibuting"' do
fill_in "dashboard_search", :with => "Contibuting" fill_in "dashboard_search", with: "Contibuting"
click_button "Search" click_button "Search"
end end
And 'Project "Shop" has wiki page "Contibuting guide"' do And 'Project "Shop" has wiki page "Contibuting guide"' do
@wiki_page = Factory :wiki, :project => @project, @wiki_page = create :wiki,
:title => "Contibuting guide", project: @project,
:slug => "contributing" title: "Contibuting guide",
slug: "contributing"
end end
Then 'I should see "Contibuting guide" wiki link' do Then 'I should see "Contibuting guide" wiki link' do
page.should have_link "Contibuting guide" page.should have_link "Contibuting guide"
end end
end end
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