summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-04-09 21:04:48 +0200
committerAzul <azul@leap.se>2013-04-09 21:04:48 +0200
commit53e3198196033f2dd77c09be6919cbef72f3f5d8 (patch)
treebdd0229623db1c2c61d8959ca5f0149b7994bb87 /users
parent2bd36ec96d42f0b4585a15759f33ff7f89075dcc (diff)
adopting tests to new behavior
Diffstat (limited to 'users')
-rw-r--r--users/test/functional/v1/sessions_controller_test.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/users/test/functional/v1/sessions_controller_test.rb b/users/test/functional/v1/sessions_controller_test.rb
index 7c6b595..0c4e325 100644
--- a/users/test/functional/v1/sessions_controller_test.rb
+++ b/users/test/functional/v1/sessions_controller_test.rb
@@ -12,13 +12,13 @@ class V1::SessionsControllerTest < ActionController::TestCase
end
test "renders json" do
- request.env['warden'].expects(:winning_strategy)
get :new, :format => :json
assert_response :success
assert_json_error nil
end
test "renders warden errors" do
+ request.env['warden.options'] = {attempted_path: 'path/to/controller'}
strategy = stub :message => {:field => :translate_me}
request.env['warden'].stubs(:winning_strategy).returns(strategy)
I18n.expects(:t).with(:translate_me).at_least_once.returns("translation stub")
@@ -38,7 +38,7 @@ class V1::SessionsControllerTest < ActionController::TestCase
test "should authorize" do
request.env['warden'].expects(:authenticate!)
- @controller.expects(:current_user).returns(@user)
+ @controller.stubs(:current_user).returns(@user)
handshake = stub(:to_hash => {h: "ash"})
session[:handshake] = handshake
@@ -46,7 +46,8 @@ class V1::SessionsControllerTest < ActionController::TestCase
assert_nil session[:handshake]
assert_response :success
- assert_json_response handshake.to_hash.merge(id: @user.id)
+ assert json_response.keys.include?("id")
+ assert json_response.keys.include?("token")
end
test "logout should reset warden user" do