diff options
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 12c1cfb30e..997c9e7e9d 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1761,6 +1761,14 @@ class BasicsTest < ActiveRecord::TestCase assert_equal "The First Topic", topics(:first).becomes(Reply).title end + def test_becomes_includes_errors + company = Company.new(:name => nil) + assert !company.valid? + original_errors = company.errors + client = company.becomes(Client) + assert_equal original_errors, client.errors + end + def test_silence_sets_log_level_to_error_in_block original_logger = ActiveRecord::Base.logger log = StringIO.new @@ -1935,4 +1943,10 @@ class BasicsTest < ActiveRecord::TestCase dev.update_attribute(:updated_at, nil) assert_match(/\/#{dev.id}$/, dev.cache_key) end + + def test_uniq_delegates_to_scoped + scope = stub + Bird.stubs(:scoped).returns(mock(:uniq => scope)) + assert_equal scope, Bird.uniq + end end |