Commit 22d0569dbbbaa12f3589717f25c340f8b67df1c7
1 parent
8114d36c
Exists in
master
and in
4 other branches
Dashboard steps: 1.9 syntax & use of create instead of Factory
Showing
4 changed files
with
33 additions
and
34 deletions
Show diff stats
features/steps/dashboard/dashboard.rb
@@ -32,7 +32,7 @@ class Dashboard < Spinach::FeatureSteps | @@ -32,7 +32,7 @@ class Dashboard < Spinach::FeatureSteps | ||
32 | end | 32 | end |
33 | 33 | ||
34 | Given 'user with name "John Doe" joined project "Shop"' do | 34 | Given 'user with name "John Doe" joined project "Shop"' do |
35 | - user = Factory.create(:user, {name: "John Doe"}) | 35 | + user = create :user, {name: "John Doe"} |
36 | project = Project.find_by_name "Shop" | 36 | project = Project.find_by_name "Shop" |
37 | Event.create( | 37 | Event.create( |
38 | project: project, | 38 | project: project, |
@@ -60,14 +60,14 @@ class Dashboard < Spinach::FeatureSteps | @@ -60,14 +60,14 @@ class Dashboard < Spinach::FeatureSteps | ||
60 | end | 60 | end |
61 | 61 | ||
62 | And 'I own project "Shop"' do | 62 | And 'I own project "Shop"' do |
63 | - @project = Factory :project, :name => 'Shop' | 63 | + @project = create :project, name: 'Shop' |
64 | @project.add_access(@user, :admin) | 64 | @project.add_access(@user, :admin) |
65 | end | 65 | end |
66 | 66 | ||
67 | And 'I have group with projects' do | 67 | And 'I have group with projects' do |
68 | - @group = Factory :group | ||
69 | - @project = Factory :project, group: @group | ||
70 | - @event = Factory :closed_issue_event, project: @project | 68 | + @group = create :group |
69 | + @project = create :project, group: @group | ||
70 | + @event = create :closed_issue_event, project: @project | ||
71 | 71 | ||
72 | @project.add_access current_user, :admin | 72 | @project.add_access current_user, :admin |
73 | end | 73 | end |
@@ -76,25 +76,25 @@ class Dashboard < Spinach::FeatureSteps | @@ -76,25 +76,25 @@ class Dashboard < Spinach::FeatureSteps | ||
76 | @project = Project.find_by_name("Shop") | 76 | @project = Project.find_by_name("Shop") |
77 | 77 | ||
78 | data = { | 78 | data = { |
79 | - :before => "0000000000000000000000000000000000000000", | ||
80 | - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | ||
81 | - :ref => "refs/heads/new_design", | ||
82 | - :user_id => @user.id, | ||
83 | - :user_name => @user.name, | ||
84 | - :repository => { | ||
85 | - :name => @project.name, | ||
86 | - :url => "localhost/rubinius", | ||
87 | - :description => "", | ||
88 | - :homepage => "localhost/rubinius", | ||
89 | - :private => true | 79 | + before: "0000000000000000000000000000000000000000", |
80 | + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | ||
81 | + ref: "refs/heads/new_design", | ||
82 | + user_id: @user.id, | ||
83 | + user_name: @user.name, | ||
84 | + repository: { | ||
85 | + name: @project.name, | ||
86 | + url: "localhost/rubinius", | ||
87 | + description: "", | ||
88 | + homepage: "localhost/rubinius", | ||
89 | + private: true | ||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | @event = Event.create( | 93 | @event = Event.create( |
94 | - :project => @project, | ||
95 | - :action => Event::Pushed, | ||
96 | - :data => data, | ||
97 | - :author_id => @user.id | 94 | + project: @project, |
95 | + action: Event::Pushed, | ||
96 | + data: data, | ||
97 | + author_id: @user.id | ||
98 | ) | 98 | ) |
99 | end | 99 | end |
100 | 100 |
features/steps/dashboard/dashboard_issues.rb
@@ -11,9 +11,9 @@ class DashboardIssues < Spinach::FeatureSteps | @@ -11,9 +11,9 @@ class DashboardIssues < Spinach::FeatureSteps | ||
11 | end | 11 | end |
12 | 12 | ||
13 | And 'I have assigned issues' do | 13 | And 'I have assigned issues' do |
14 | - project = Factory :project | 14 | + project = create :project |
15 | project.add_access(@user, :read, :write) | 15 | project.add_access(@user, :read, :write) |
16 | 16 | ||
17 | - 2.times { Factory :issue, :author => @user, :assignee => @user, :project => project } | 17 | + 2.times { create :issue, author: @user, assignee: @user, project: project } |
18 | end | 18 | end |
19 | end | 19 | end |
features/steps/dashboard/dashboard_merge_requests.rb
@@ -11,13 +11,13 @@ class DashboardMergeRequests < Spinach::FeatureSteps | @@ -11,13 +11,13 @@ class DashboardMergeRequests < Spinach::FeatureSteps | ||
11 | end | 11 | end |
12 | 12 | ||
13 | And 'I have authored merge requests' do | 13 | And 'I have authored merge requests' do |
14 | - project1 = Factory :project | ||
15 | - project2 = Factory :project | 14 | + project1 = create :project |
15 | + project2 = create :project | ||
16 | 16 | ||
17 | project1.add_access(@user, :read, :write) | 17 | project1.add_access(@user, :read, :write) |
18 | project2.add_access(@user, :read, :write) | 18 | project2.add_access(@user, :read, :write) |
19 | 19 | ||
20 | - merge_request1 = Factory :merge_request, :author => @user, :project => project1 | ||
21 | - merge_request2 = Factory :merge_request, :author => @user, :project => project2 | 20 | + merge_request1 = create :merge_request, author: @user, project: project1 |
21 | + merge_request2 = create :merge_request, author: @user, project: project2 | ||
22 | end | 22 | end |
23 | end | 23 | end |
features/steps/dashboard/dashboard_search.rb
@@ -3,7 +3,7 @@ class DashboardSearch < Spinach::FeatureSteps | @@ -3,7 +3,7 @@ class DashboardSearch < Spinach::FeatureSteps | ||
3 | include SharedPaths | 3 | include SharedPaths |
4 | 4 | ||
5 | Given 'I search for "Sho"' do | 5 | Given 'I search for "Sho"' do |
6 | - fill_in "dashboard_search", :with => "Sho" | 6 | + fill_in "dashboard_search", with: "Sho" |
7 | click_button "Search" | 7 | click_button "Search" |
8 | end | 8 | end |
9 | 9 | ||
@@ -12,24 +12,23 @@ class DashboardSearch < Spinach::FeatureSteps | @@ -12,24 +12,23 @@ class DashboardSearch < Spinach::FeatureSteps | ||
12 | end | 12 | end |
13 | 13 | ||
14 | And 'I own project "Shop"' do | 14 | And 'I own project "Shop"' do |
15 | - @project = Factory :project, :name => "Shop" | 15 | + @project = create :project, name: "Shop" |
16 | @project.add_access(@user, :admin) | 16 | @project.add_access(@user, :admin) |
17 | end | 17 | end |
18 | 18 | ||
19 | Given 'I search for "Contibuting"' do | 19 | Given 'I search for "Contibuting"' do |
20 | - fill_in "dashboard_search", :with => "Contibuting" | 20 | + fill_in "dashboard_search", with: "Contibuting" |
21 | click_button "Search" | 21 | click_button "Search" |
22 | end | 22 | end |
23 | 23 | ||
24 | And 'Project "Shop" has wiki page "Contibuting guide"' do | 24 | And 'Project "Shop" has wiki page "Contibuting guide"' do |
25 | - @wiki_page = Factory :wiki, :project => @project, | ||
26 | - :title => "Contibuting guide", | ||
27 | - :slug => "contributing" | 25 | + @wiki_page = create :wiki, |
26 | + project: @project, | ||
27 | + title: "Contibuting guide", | ||
28 | + slug: "contributing" | ||
28 | end | 29 | end |
29 | 30 | ||
30 | Then 'I should see "Contibuting guide" wiki link' do | 31 | Then 'I should see "Contibuting guide" wiki link' do |
31 | page.should have_link "Contibuting guide" | 32 | page.should have_link "Contibuting guide" |
32 | end | 33 | end |
33 | - | ||
34 | - | ||
35 | end | 34 | end |