1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Fixed some Ruby 1.9 issues/bugs.

This commit is contained in:
Jonas Grimfelt 2010-01-21 10:44:12 +08:00 committed by José Valim
parent f50ec773b2
commit 0c7c762c16
4 changed files with 9 additions and 6 deletions

View file

@ -44,7 +44,8 @@ class DeviseMailer < ::ActionMailer::Base
def mailer_sender(mapping)
if Devise.mailer_sender.is_a?(Proc)
Devise.mailer_sender.call(mapping.name)
block_args = mapping.name if Devise.mailer_sender.arity > 0
Devise.mailer_sender.call(*block_args)
else
Devise.mailer_sender
end

View file

@ -2,10 +2,10 @@ require "bcrypt"
module Devise
module Encryptors
# = BCrypt
# = BCrypt
# Uses the BCrypt hash algorithm to encrypt passwords.
class Bcrypt < Base
# Gererates a default password digest based on stretches, salt, pepper and the
# incoming password. We don't strech it ourselves since BCrypt does so internally.
def self.digest(password, stretches, salt, pepper)

View file

@ -1,3 +1,5 @@
gem 'bcrypt-ruby'
class Encryptors < ActiveSupport::TestCase
test 'should match a password created by authlogic' do
@ -17,7 +19,7 @@ class Encryptors < ActiveSupport::TestCase
encryptor = Devise::Encryptors::ClearanceSha1.digest('123mudar', nil, '65c58472c207c829f28c68619d3e3aefed18ab3f', nil)
assert_equal clearance, encryptor
end
Devise::ENCRYPTORS_LENGTH.each do |key, value|
test "should have length #{value} for #{key.inspect}" do
swap Devise, :encryptor => key do

View file

@ -18,7 +18,7 @@ class ValidatableTest < ActiveSupport::TestCase
user.email = existing_user.email
assert user.invalid?
assert user.errors[:email]
assert_equal 1, user.errors[:email].to_a.size
assert_equal 1, [*user.errors[:email]].size
assert_equal 'has already been taken', user.errors[:email]
end
@ -30,7 +30,7 @@ class ValidatableTest < ActiveSupport::TestCase
user.email = email
assert user.invalid?, 'should be invalid with email ' << email
assert user.errors[:email]
assert_equal 1, user.errors[:email].to_a.size
assert_equal 1, [*user.errors[:email]].size
assert_equal 'is invalid', user.errors[:email]
end
end