Skip to content

Commit 06eba8f

Browse files
committed
Push user show feature complexity into step definitions
1 parent 10ea33a commit 06eba8f

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

features/step_definitions/user_steps.rb

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
Given /^no user exists with an email of "(.*)"$/ do |email|
2-
User.find(:first, :conditions => { :email => email }).should be_nil
3-
end
4-
51
Given /^I am a user named "([^"]*)" with an email "([^"]*)" and password "([^"]*)"$/ do |name, email, password|
62
User.new(:name => name,
73
:email => email,
@@ -13,14 +9,6 @@
139
visit '/users/sign_out'
1410
end
1511

16-
When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
17-
visit '/users/sign_out'
18-
visit '/users/sign_in'
19-
fill_in "Email", :with => email
20-
fill_in "Password", :with => password
21-
click_button "Sign in"
22-
end
23-
2412
When /^I go to the homepage$/ do
2513
visit '/'
2614
end
@@ -45,18 +33,6 @@
4533
page.should have_content(text)
4634
end
4735

48-
When /^I press "([^"]*)"$/ do |label|
49-
click_button label
50-
end
51-
52-
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
53-
fill_in(field, :with => value)
54-
end
55-
56-
When /^I follow "([^"]*)"$/ do |text|
57-
click_link text
58-
end
59-
6036
def valid_user
6137
@user ||= { :name => "Testy McUserton", :email => "testy@userton.com",
6238
:password => "please", :password_confirmation => "please"}
@@ -169,3 +145,11 @@ def sign_up user
169145
Then /^I should see an account edited message$/ do
170146
page.should have_content "You updated your account successfully."
171147
end
148+
149+
When /^I look at the list of users$/ do
150+
visit '/'
151+
end
152+
153+
Then /^I should see my name$/ do
154+
page.should have_content valid_user[:name]
155+
end

features/users/user_show.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Feature: Show Users
44
so I can know if the site has users
55

66
Scenario: Viewing users
7-
Given I am a user named "foo" with an email "user@test.com" and password "please"
8-
When I go to the homepage
9-
Then I should see "User: foo"
7+
Given I exist as a user
8+
When I look at the list of users
9+
Then I should see my name

0 commit comments

Comments
 (0)