mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Add update_attribute method to Mongoid Shim for devise tests, to fix failing test
Mongoid does not have this method in the current beta version (2.0.0.beta.20).
This commit is contained in:
@@ -56,7 +56,7 @@ class HttpAuthenticationTest < ActionController::IntegrationTest
|
||||
assert_match "<email>user@test.com</email>", response.body
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def sign_in_as_new_user_with_http(username="user@test.com", password="123456")
|
||||
@@ -64,11 +64,11 @@ class HttpAuthenticationTest < ActionController::IntegrationTest
|
||||
get users_path(:format => :xml), {}, "HTTP_AUTHORIZATION" => "Basic #{ActiveSupport::Base64.encode64("#{username}:#{password}")}"
|
||||
user
|
||||
end
|
||||
|
||||
|
||||
# Sign in with oauth2 token. This is just to test that it isn't misinterpreted as basic authentication
|
||||
def add_oauth2_header
|
||||
user = create_user
|
||||
get users_path(:format => :xml), {}, "HTTP_AUTHORIZATION" => "OAuth #{ActiveSupport::Base64.encode64("#{user.email}:123456")}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,8 +17,13 @@ module Shim
|
||||
end
|
||||
end
|
||||
|
||||
# overwrite equality (because some devise tests use this for asserting model equality)
|
||||
# overwrite equality (because some devise tests use this for asserting model equality)
|
||||
def ==(other)
|
||||
other.is_a?(self.class) && _id == other._id
|
||||
end
|
||||
|
||||
# Mongoid does not have this method in the current beta version (2.0.0.beta.20)
|
||||
def update_attribute(attribute, value)
|
||||
update_attributes(attribute => value)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user