1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix test_with_abstract_class_scope_should_be_executed_in_correct_context

To allow MS SQL Server's quote.
This commit is contained in:
Ryuta Kamizono 2020-01-29 03:50:21 +09:00
parent 53d94ddef2
commit c4edca3612

View file

@ -523,13 +523,8 @@ class DefaultScopingTest < ActiveRecord::TestCase
end
def test_with_abstract_class_scope_should_be_executed_in_correct_context
vegetarian_pattern, gender_pattern = if current_adapter?(:Mysql2Adapter)
[/`lions`.`is_vegetarian`/, /`lions`.`gender`/]
elsif current_adapter?(:OracleAdapter)
[/"LIONS"."IS_VEGETARIAN"/, /"LIONS"."GENDER"/]
else
[/"lions"."is_vegetarian"/, /"lions"."gender"/]
end
vegetarian_pattern = /#{Regexp.escape(Lion.connection.quote_table_name("lions.is_vegetarian"))}/i
gender_pattern = /#{Regexp.escape(Lion.connection.quote_table_name("lions.gender"))}/i
assert_match vegetarian_pattern, Lion.all.to_sql
assert_match gender_pattern, Lion.female.to_sql