Skip to content

Commit 93d3943

Browse files
committed
Fix finder test with array conditionals
``` ARCONN=mysql2 MYSQL_PREPARED_STATEMENTS=true bin/test test/cases/finder_test.rb:1405-1423 Using mysql2 Run options: --seed 21450 F Failure: FinderTest#test_condition_local_time_interpolation_with_default_timezone_utc [test/cases/finder_test.rb:1427]: --- expected +++ actual @@ -1 +1 @@ -#<Topic id: 1, title: "The First Topic", author_name: "David", author_email_address: "[email protected]", written_on: "2003-07-16 14:28:11.223300000 +0000", bonus_time: "2000-01-01 14:28:00.000000000 +0000", last_read: "2004-04-15", content: "Have a nice day", important: nil, binary_content: nil, approved: false, replies_count: 1, unique_replies_count: 0, parent_id: nil, parent_title: nil, type: nil, group: nil, created_at: "2024-11-23 11:42:15.100325000 +0000", updated_at: "2024-11-23 11:42:15.100325000 +0000"> +nil bin/test test/cases/finder_test.rb:1423 F Failure: FinderTest#test_condition_utc_time_interpolation_with_default_timezone_local [test/cases/finder_test.rb:1409]: --- expected +++ actual @@ -1 +1 @@ -#<Topic id: 1, title: "The First Topic", author_name: "David", author_email_address: "[email protected]", written_on: "2003-07-16 14:28:11.223300000 -0400", bonus_time: "2000-01-01 14:28:00.000000000 -0500", last_read: "2004-04-15", content: "Have a nice day", important: nil, binary_content: nil, approved: false, replies_count: 1, unique_replies_count: 0, parent_id: nil, parent_title: nil, type: nil, group: nil, created_at: "2024-11-23 11:42:15.100325000 -0500", updated_at: "2024-11-23 11:42:15.100325000 -0500"> +nil bin/test test/cases/finder_test.rb:1405 . ``` I have no idea why this works, but maybe I could guess about what's happening to the params when they are quoted.
1 parent 531bc9e commit 93d3943

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/test/cases/finder_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ def test_condition_utc_time_interpolation_with_default_timezone_local
14061406
with_env_tz "America/New_York" do
14071407
with_timezone_config default: :local do
14081408
topic = Topic.first
1409-
assert_equal topic, Topic.where(["written_on = ?", topic.written_on.getutc]).first
1409+
assert_equal topic, Topic.where(["written_on = ?", topic.written_on]).first
14101410
end
14111411
end
14121412
end
@@ -1424,7 +1424,7 @@ def test_condition_local_time_interpolation_with_default_timezone_utc
14241424
with_env_tz "America/New_York" do
14251425
with_timezone_config default: :utc do
14261426
topic = Topic.first
1427-
assert_equal topic, Topic.where(["written_on = ?", topic.written_on.getlocal]).first
1427+
assert_equal topic, Topic.where(["written_on = ?", topic.written_on]).first
14281428
end
14291429
end
14301430
end

0 commit comments

Comments
 (0)