From 7308991630af3fb8a2a7e2cde9fd322316153ec2 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sun, 5 Nov 2017 19:19:41 +0000 Subject: Execute `ConfirmationValidator` validation when `_confirmation`'s value is `false` --- .../test/cases/validations/confirmation_validation_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activemodel/test/cases') diff --git a/activemodel/test/cases/validations/confirmation_validation_test.rb b/activemodel/test/cases/validations/confirmation_validation_test.rb index e84415a868..8b2c65289b 100644 --- a/activemodel/test/cases/validations/confirmation_validation_test.rb +++ b/activemodel/test/cases/validations/confirmation_validation_test.rb @@ -37,6 +37,19 @@ class ConfirmationValidationTest < ActiveModel::TestCase assert t.valid? end + def test_validates_confirmation_of_with_boolean_attribute + Topic.validates_confirmation_of(:approved) + + t = Topic.new(approved: true, approved_confirmation: nil) + assert t.valid? + + t.approved_confirmation = false + assert t.invalid? + + t.approved_confirmation = true + assert t.valid? + end + def test_validates_confirmation_of_for_ruby_class Person.validates_confirmation_of :karma -- cgit v1.2.3