diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 14:29:00 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 14:29:07 -0700 |
commit | f22b40a8f223e0b2f5194b6f3ce24cafd5cd3a05 (patch) | |
tree | 145afc626c9b5cebe2cd820de069a25742535417 /activerecord/test | |
parent | bfc986811c5cbcfcc856916a1b09fcbf6551ecf5 (diff) | |
download | rails-f22b40a8f223e0b2f5194b6f3ce24cafd5cd3a05.tar.gz rails-f22b40a8f223e0b2f5194b6f3ce24cafd5cd3a05.tar.bz2 rails-f22b40a8f223e0b2f5194b6f3ce24cafd5cd3a05.zip |
make sure we use the engine assigned to the table when quoting
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index b434b0faa8..16fd9a7465 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -69,6 +69,24 @@ class BasicsTest < ActiveRecord::TestCase end end + def test_use_table_engine_for_quoting_where + relation = Topic.where(Topic.arel_table[:id].eq(1)) + engine = relation.table.engine + + fakepool = Class.new(Struct.new(:spec)) { + def with_connection; yield self; end + def connection_pool; self; end + def quote_table_name(*args); raise "lol quote_table_name"; end + } + + relation.table.engine = fakepool.new(engine.connection_pool.spec) + + error = assert_raises(RuntimeError) { relation.to_a } + assert_match('lol', error.message) + ensure + relation.table.engine = engine + end + def test_preserving_time_objects assert_kind_of( Time, Topic.find(1).bonus_time, |