Permalink
Browse files

Refactoring tests

  • Loading branch information...
thiagotnunes committed Mar 10, 2012
1 parent 340ab96 commit 40a34037ff314ac7b7324a621cc474a88f10818a
Showing with 9 additions and 3 deletions.
  1. +1 −3 features/login.feature
  2. +8 −0 features/step_definitions/login_steps.rb
View
@@ -22,10 +22,8 @@ Feature: Login
Then I should be logged in
Scenario: Forgot password
- Given I signup
- And I activate my account
+ Given I am an existing customer
When I forgot my password
Then I should receive reset password instructions in my email
And I should be able to reset my password to "newPassword"
And I should be able to login with "newPassword"
- And I should be logged in
@@ -4,6 +4,13 @@
visit(home_url)
end
+Given /^I am an existing customer$/ do
+ user = User.new(:username => "John", :password => "password", :password_confirmation => "password", :email => "john@doe.com")
+ user.role = :customer
+ user.save!
+ user.activate!
+end
+
When /^I signup$/ do
click_link("Sign up")
fill_in("Username", :with => "John")
@@ -67,4 +74,5 @@
fill_in("Username", :with => "John")
fill_in("Password", :with => password)
click_button("Log in")
+ step "I should be logged in"
end

0 comments on commit 40a3403

Please sign in to comment.