josevalim-auth_helpers 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -54,7 +54,7 @@ module AuthHelpers
|
|
54
54
|
describe 'with an invalid perishable token' do
|
55
55
|
it "should set an error message" do
|
56
56
|
record = base.described_class.find_and_confirm(:perishable_token => "invalid token")
|
57
|
-
record.errors.on(:perishable_token).should == record.errors.generate_message(:perishable_token, :invalid_confirmation, :default => :invalid)
|
57
|
+
record.errors.on(:perishable_token).should == record.errors.generate_message(:perishable_token, :invalid_confirmation, :default => [:invalid])
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should return a new record with the perishable token set" do
|
@@ -32,7 +32,7 @@ module AuthHelpers
|
|
32
32
|
|
33
33
|
it "should not reset password if the given reset password code is invalid" do
|
34
34
|
record = base.described_class.find_and_reset_password(:perishable_token => 'invalid_token', :password => '654321', :password_confirmation => '654321')
|
35
|
-
record.errors.on(:perishable_token).should == record.errors.generate_message(:perishable_token, :invalid_reset_password, :default => :invalid)
|
35
|
+
record.errors.on(:perishable_token).should == record.errors.generate_message(:perishable_token, :invalid_reset_password, :default => [:invalid])
|
36
36
|
@recoverable.reload
|
37
37
|
@recoverable.valid_password?('654321').should be_false
|
38
38
|
end
|
data/lib/auth_helpers.rb
CHANGED
@@ -15,7 +15,7 @@ module AuthHelpers
|
|
15
15
|
def self.new_with_perishable_token_error(klass, message=:invalid, options={})
|
16
16
|
record = klass.new(options)
|
17
17
|
record.perishable_token = options[:perishable_token]
|
18
|
-
record.errors.add(:perishable_token, message, :default => :invalid)
|
18
|
+
record.errors.add(:perishable_token, message, :default => [:invalid])
|
19
19
|
record
|
20
20
|
end
|
21
21
|
|