Skip to content

Commit

Permalink
Add test support for new validations
Browse files Browse the repository at this point in the history
  • Loading branch information
bnauta committed Nov 14, 2013
1 parent 495dfe1 commit 3196c75
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/acts_as_authentic_test/password_test.rb
Expand Up @@ -111,16 +111,25 @@ def test_validates_length_of_password


u.password = "test" u.password = "test"
assert !u.valid? assert !u.valid?
assert u.errors[:password_confirmation].size == 0
if ActiveModel.respond_to?(:version) and ActiveModel.version.segments.first >= 4
assert u.errors[:password_confirmation].size == 5
else
assert u.errors[:password_confirmation].size == 0
end
end end


def test_validates_confirmation_of_password def test_validates_confirmation_of_password
u = User.new u = User.new
u.password = "test" u.password = "test"
u.password_confirmation = "test2" u.password_confirmation = "test2"
assert !u.valid? assert !u.valid?
assert u.errors[:password].size > 0 # assert u.errors[:password].size > 0

if ActiveModel.respond_to?(:version) and ActiveModel.version.segments.first >= 4
assert u.errors[:password_confirmation].size > 0
else
assert u.errors[:password].size > 0
end
u.password_confirmation = "test" u.password_confirmation = "test"
assert !u.valid? assert !u.valid?
assert u.errors[:password].size == 0 assert u.errors[:password].size == 0
Expand Down

0 comments on commit 3196c75

Please sign in to comment.