diff options
Diffstat (limited to 'users/test/functional/v1')
-rw-r--r-- | users/test/functional/v1/sessions_controller_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/users/test/functional/v1/sessions_controller_test.rb b/users/test/functional/v1/sessions_controller_test.rb index be085ce..535da52 100644 --- a/users/test/functional/v1/sessions_controller_test.rb +++ b/users/test/functional/v1/sessions_controller_test.rb @@ -7,7 +7,7 @@ class V1::SessionsControllerTest < ActionController::TestCase setup do @request.env['HTTP_HOST'] = 'api.lvh.me' - @user = stub :login => "me", :id => 123 + @user = stub_record :user @client_hex = 'a123' end @@ -36,6 +36,15 @@ class V1::SessionsControllerTest < ActionController::TestCase post :create, :login => @user.login, 'A' => @client_hex end + test "should send salt" do + User.expects(:find_by_login).with(@user.login).returns(@user) + + post :create, :login => @user.login + + assert_equal @user, assigns(:user) + assert_json_response salt: @user.salt + end + test "should authorize" do request.env['warden'].expects(:authenticate!) @controller.expects(:current_user).returns(@user) |