diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-27 11:27:51 -0700 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-03-28 15:31:32 +0100 |
commit | 4c44ca5cb9544b4186a0c9d54a7bfc9d30896f62 (patch) | |
tree | 96603224f0e6089df233bb7da55d44a556e4006a /activerecord/test/cases | |
parent | 0d052c0e399c179cd918c9fbad512775387e20c7 (diff) | |
download | rails-4c44ca5cb9544b4186a0c9d54a7bfc9d30896f62.tar.gz rails-4c44ca5cb9544b4186a0c9d54a7bfc9d30896f62.tar.bz2 rails-4c44ca5cb9544b4186a0c9d54a7bfc9d30896f62.zip |
Test for #5549.
Cherry-picked from e96d04a2e4e244ea5053cb4e8ab97db604d0c796.
Conflicts:
activerecord/lib/active_record/attribute_methods/read.rb
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index aeb44da2b2..300a3636e3 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -61,7 +61,11 @@ end class Weird < ActiveRecord::Base; end -class Boolean < ActiveRecord::Base; end +class Boolean < ActiveRecord::Base + def has_fun + super + end +end class LintTest < ActiveRecord::TestCase include ActiveModel::Lint::Tests @@ -930,6 +934,16 @@ class BasicsTest < ActiveRecord::TestCase assert b_true.value? end + def test_boolean_without_questionmark + b_true = Boolean.create({ "value" => true }) + true_id = b_true.id + + subclass = Class.new(Boolean).find true_id + superclass = Boolean.find true_id + + assert_equal superclass.read_attribute(:has_fun), subclass.read_attribute(:has_fun) + end + def test_boolean_cast_from_string b_blank = Boolean.create({ "value" => "" }) blank_id = b_blank.id |