From f8ed140af18db781304cb1168a462c049595acbb Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Mon, 19 Mar 2012 01:21:58 +0000 Subject: [PATCH] Add api_sign_in method for UserIntegrationHelpers --- spec/support/user_integration_helpers.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/support/user_integration_helpers.rb b/spec/support/user_integration_helpers.rb index d543934..5336be8 100644 --- a/spec/support/user_integration_helpers.rb +++ b/spec/support/user_integration_helpers.rb @@ -6,4 +6,13 @@ module UserIntegrationHelpers fill_in 'Password', :with => user.password click_button('Sign in') end + + def api_sign_in + user = Factory.create :user + + post api_sessions_path, :format => :json, :session => { + :email => user.email, + :password => user.password + } + end end