Permalink
Browse files

consolidate all user steps for Cucumber into one file

  • Loading branch information...
1 parent 507c1f4 commit 76b123ef691474a332f30ba1791863e86d44dd16 @fortuity committed Mar 14, 2011
@@ -1,26 +0,0 @@
-Given /^no user exists with an email of "(.*)"$/ do |email|
- assert_nil User.find(:first, :conditions => { :email => email })
-end
-
-Given /^I am a user named "([^"]*)" with an email "([^"]*)" and password "([^"]*)"$/ do |name, email, password|
- User.new(:name => name,
- :email => email,
- :password => password,
- :password_confirmation => password).save!
-end
-
-Given /^I am a new, authenticated user$/ do
- email = 'testing@man.net'
- login = 'Testing man'
- password = 'secretpass'
-
- Given %{I have one user "#{email}" with password "#{password}"}
- And %{I go to login}
- And %{I fill in "user_email" with "#{email}"}
- And %{I fill in "user_password" with "#{password}"}
- And %{I press "Sign in"}
-end
-
-Then /^I should be already signed in$/ do
- And %{I should see "Logout"}
-end
@@ -1,3 +0,0 @@
-Given /^I am not logged in$/ do
- visit('/users/sign_out') # ensure that at least
-end
@@ -1,3 +1,30 @@
+Given /^no user exists with an email of "(.*)"$/ do |email|
+ assert_nil User.find(:first, :conditions => { :email => email })
+end
+
+Given /^I am a user named "([^"]*)" with an email "([^"]*)" and password "([^"]*)"$/ do |name, email, password|
+ User.new(:name => name,
+ :email => email,
+ :password => password,
+ :password_confirmation => password).save!
+end
+
+Given /^I am a new, authenticated user$/ do
+ email = 'testing@man.net'
+ login = 'Testing man'
+ password = 'secretpass'
+
+ Given %{I have one user "#{email}" with password "#{password}"}
+ And %{I go to login}
+ And %{I fill in "user_email" with "#{email}"}
+ And %{I fill in "user_password" with "#{password}"}
+ And %{I press "Sign in"}
+end
+
+Then /^I should be already signed in$/ do
+ And %{I should see "Logout"}
+end
+
Given /^I am signed up as "(.*)\/(.*)"$/ do |email, password|
Given %{I am not logged in}
When %{I go to the sign up page}
@@ -37,4 +64,8 @@
And %{I should see "Sign up"}
And %{I should see "Login"}
And %{I should not see "Logout"}
-end
+end
+
+Given /^I am not logged in$/ do
+ visit('/users/sign_out') # ensure that at least
+end

0 comments on commit 76b123e

Please sign in to comment.