fix transient test failures

This commit is contained in:
Rodrigo Ra 2015-07-13 22:44:04 -03:00
parent 775737619a
commit 851d121ea8

View File

@ -72,16 +72,19 @@ module ActiveModel
assert_equal(nil, ActionController::Base.cache_store.fetch(@post.cache_key)) assert_equal(nil, ActionController::Base.cache_store.fetch(@post.cache_key))
assert_equal(nil, ActionController::Base.cache_store.fetch(@comment.cache_key)) assert_equal(nil, ActionController::Base.cache_store.fetch(@comment.cache_key))
Timecop.freeze(Time.now) do
post = render_object_with_cache(@post) post = render_object_with_cache(@post)
assert_equal(@post_serializer.attributes, ActionController::Base.cache_store.fetch(@post.cache_key)) assert_equal(@post_serializer.attributes, ActionController::Base.cache_store.fetch(@post.cache_key))
assert_equal(@comment_serializer.attributes, ActionController::Base.cache_store.fetch(@comment.cache_key)) assert_equal(@comment_serializer.attributes, ActionController::Base.cache_store.fetch(@comment.cache_key))
end end
end
def test_associations_cache_when_updated def test_associations_cache_when_updated
# Clean the Cache # Clean the Cache
ActionController::Base.cache_store.clear ActionController::Base.cache_store.clear
Timecop.freeze(Time.now) do
# Generate a new Cache of Post object and each objects related to it. # Generate a new Cache of Post object and each objects related to it.
render_object_with_cache(@post) render_object_with_cache(@post)
@ -101,6 +104,7 @@ module ActiveModel
assert_equal(new_comment_serializer.attributes, ActionController::Base.cache_store.fetch(new_comment.cache_key)) assert_equal(new_comment_serializer.attributes, ActionController::Base.cache_store.fetch(new_comment.cache_key))
assert_equal(@post_serializer.attributes, ActionController::Base.cache_store.fetch(@post.cache_key)) assert_equal(@post_serializer.attributes, ActionController::Base.cache_store.fetch(@post.cache_key))
end end
end
def test_fragment_fetch_with_virtual_associations def test_fragment_fetch_with_virtual_associations
expected_result = { expected_result = {