mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactor test_find_by_does_not_use_statement_cache_if_table_name_is_changed
This commit is contained in:
parent
efe121eab0
commit
8646911292
1 changed files with 2 additions and 2 deletions
|
@ -109,11 +109,11 @@ module ActiveRecord
|
|||
def test_find_by_does_not_use_statement_cache_if_table_name_is_changed
|
||||
book = Book.create(name: "my book")
|
||||
|
||||
Book.find_by(name: "my book") # warming the statement cache.
|
||||
Book.find_by(name: book.name) # warming the statement cache.
|
||||
|
||||
# changing the table name should change the query that is not cached.
|
||||
Book.table_name = :birds
|
||||
assert_nil Book.find_by(name: "my book")
|
||||
assert_nil Book.find_by(name: book.name)
|
||||
ensure
|
||||
Book.table_name = :books
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue