Permalink
Browse files

Added step definitions for auth, all cucu pass

  • Loading branch information...
1 parent 95e1d95 commit 67dcceff38283cc5856e6c5af69edd239c5c01d4 @YogiZoli committed Apr 15, 2012
Showing with 31 additions and 0 deletions.
  1. +31 −0 features/step_definitions/authentication_steps.rb
@@ -0,0 +1,31 @@
+Given /^a user visits the signin page$/ do
+ visit signin_path
+end
+
+When /^he submits invalid signin information$/ do
+ click_button "Sign in"
+end
+
+Then /^he should see an error message$/ do
+ page.should have_selector('div.alert.alert-error')
+end
+
+Given /^the user has an account$/ do
+ @user = User.create(name: "Example User", email: "user@example.com",
+ password: "foobar", password_confirmation: "foobar")
+end
+
+When /^the user submits valid signin information$/ do
+ visit signin_path
+ fill_in "Email", with: @user.email
+ fill_in "Password", with: @user.password
+ click_button "Sign in"
+end
+
+Then /^he should see his profile page$/ do
+ page.should have_selector('title', text: @user.name)
+end
+
+Then /^he should see a signout link$/ do
+ page.should have_link('Sign out', href: signout_path)
+end

0 comments on commit 67dccef

Please sign in to comment.