Skip to content

Commit

Permalink
Rewrite the test in the new way to assert the record also
Browse files Browse the repository at this point in the history
  • Loading branch information
maniSHarma7575 committed Aug 19, 2024
1 parent aa5e6f0 commit 14dd096
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def test_where_with_rational_for_string_column_using_bind_parameters
end

def test_where_with_nil_for_string_column_using_bind_parameters
relation = Post.where("LOWER(title) = ?", nil)
post = Post.create!
relation = Post.where("LOWER(title) IS ?", nil)
assert_equal post, relation.first

expected_sql = %{SELECT "posts".* FROM "posts" WHERE (LOWER(title) = NULL)}
expected_sql = %{SELECT "posts".* FROM "posts" WHERE (LOWER(title) IS NULL)}
assert_equal(expected_sql, relation.to_sql)

assert_empty relation.to_a
end

private
Expand Down

0 comments on commit 14dd096

Please sign in to comment.