Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rails.cache.clear added to all tests

  • Loading branch information...
commit 8fa3eb2c0b30cfef69ff146eeba3bfcd2833cf9b 1 parent d9aee74
@mustafaturan authored
View
3  test/dummy/config/environments/test.rb
@@ -34,4 +34,7 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+
+ # dalli store for caching
+ config.cache_store = :dalli_store#, "/Users/mustafat/test"#, "127.0.0.1:11211"
end
View
6 test/find_cache_test.rb
@@ -5,6 +5,7 @@ class FindCacheTest < Test::Unit::TestCase
# record test
def test_user_find_by_id_should_be_find_cache
+ Rails.cache.clear
user = User.create email: "test@videofork.com", password: "test1234"
id = user.id
assert_equal User.find_by_id(id), User.find_cache(id)
@@ -12,18 +13,21 @@ def test_user_find_by_id_should_be_find_cache
# find_cache_has_one test
def test_user_post_should_be_user_post_cache
+ Rails.cache.clear
user = User.first
assert_equal user.post, user.post_cache
end
# find_cache_belongs_to test
def test_post_user_should_be_post_user_cache
+ Rails.cache.clear
post = Post.first
assert_equal post.user, post.user_cache
end
# record update test
def test_post_update_should_expire_the_post_cache
+ Rails.cache.clear
post = Post.first
Post.find_cache(post.id) # to cache the post
post.update_attributes(title: "test", body: "hello world!")
@@ -32,6 +36,7 @@ def test_post_update_should_expire_the_post_cache
# counter cache fix test
def test_after_adding_comment_post_should_expire_the_post_cache
+ Rails.cache.clear
post = Post.first
Post.find_cache(post.id) # to cache the post
Comment.create post_id: post.id, content: "test content for comment"
@@ -40,6 +45,7 @@ def test_after_adding_comment_post_should_expire_the_post_cache
# find_all_cache test
def test_find_all_by_id_should_be_find_all_cache
+ Rails.cache.clear
c1 = Comment.create post_id: Post.first.id, content: "test 1 content for comment"
c2 = Comment.create post_id: Post.first.id, content: "test 2 content for comment"
c3 = Comment.create post_id: Post.first.id, content: "test 3 content for comment"
Please sign in to comment.
Something went wrong with that request. Please try again.