提交 1a693c79 编写于 作者: S Sean Griffin

Fix test failures on MySQL

There were a few places where I missed a `create` vs `new`
before_type_cast check, and the semantics of `reload` became wrong.
上级 07723c23
......@@ -35,7 +35,9 @@ def save!(*)
# <tt>reload</tt> the record and clears changed attributes.
def reload(*)
super.tap do
clear_changes_information
@mutation_tracker = AttributeMutationTracker.new(@attributes)
@previous_mutation_tracker = nil
@changed_attributes = HashWithIndifferentAccess.new
end
end
......
......@@ -177,7 +177,7 @@ def test_read_attributes_before_type_cast
if current_adapter?(:MysqlAdapter, :Mysql2Adapter)
def test_read_attributes_before_type_cast_on_boolean
bool = Boolean.create({ "value" => false })
bool = Boolean.new({ "value" => false })
if RUBY_PLATFORM =~ /java/
# JRuby will return the value before typecast as string
assert_equal "0", bool.reload.attributes_before_type_cast["value"]
......
......@@ -96,7 +96,9 @@ def test_cache_key_changes_when_child_touched
owner.update_column :updated_at, Time.current
key = owner.cache_key
assert pet.touch
travel(1.second) do
assert pet.touch
end
assert_not_equal key, owner.reload.cache_key
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册