summaryrefslogtreecommitdiff
path: root/users/test/unit
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-26 11:54:11 +0100
committerAzul <azul@leap.se>2012-11-26 11:54:11 +0100
commit595518684b9c4364f96c97a84cc481b5ae0da981 (patch)
treeee5aafd33cf90f4c2d099d364f6da1d6f7331024 /users/test/unit
parentce0999ead0d61db1f6534ee9d8114c4551542e80 (diff)
simplified controller and adjusted tests
Also added #assert_json_error to tests.
Diffstat (limited to 'users/test/unit')
-rw-r--r--users/test/unit/user_test.rb1
-rw-r--r--users/test/unit/warden_strategy_secure_remote_password_test.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/users/test/unit/user_test.rb b/users/test/unit/user_test.rb
index 92c1463..cce11c2 100644
--- a/users/test/unit/user_test.rb
+++ b/users/test/unit/user_test.rb
@@ -5,6 +5,7 @@ class UserTest < ActiveSupport::TestCase
include SRP::Util
setup do
@attribs = User.valid_attributes_hash
+ User.find_by_login(@attribs[:login]).try(:destroy)
@user = User.new(@attribs)
end
diff --git a/users/test/unit/warden_strategy_secure_remote_password_test.rb b/users/test/unit/warden_strategy_secure_remote_password_test.rb
index 79480f0..319809a 100644
--- a/users/test/unit/warden_strategy_secure_remote_password_test.rb
+++ b/users/test/unit/warden_strategy_secure_remote_password_test.rb
@@ -32,7 +32,7 @@ class WardenStrategySecureRemotePasswordTest < ActiveSupport::TestCase
User.expects(:find_by_param).with(unknown).raises(RECORD_NOT_FOUND)
post :create, :login => unknown
assert_response :success
- assert_json_response :errors => {"login" => ["unknown user"]}
+ assert_json_error "login" => ["unknown user"]
end
test "should authorize" do
@@ -56,7 +56,7 @@ class WardenStrategySecureRemotePasswordTest < ActiveSupport::TestCase
post :update, :id => @user.login, :client_auth => @client_hex
assert_nil session[:handshake]
assert_nil session[:user_id]
- assert_json_response :errors => {"password" => ["wrong password"]}
+ assert_json_error "password" => ["wrong password"]
end
=end