0
@@ -232,7 +232,7 @@ class ActionCacheTest < Test::Unit::TestCase
0
cached_time = content_to_cache
0
assert_equal cached_time, @response.body
0
- assert
_cache_exists 'hostname.com/action_caching_test'0
+ assert
fragment_exist?('hostname.com/action_caching_test')0
@@ -243,7 +243,7 @@ class ActionCacheTest < Test::Unit::TestCase
0
cached_time = content_to_cache
0
assert_equal cached_time, @response.body
0
- assert
_cache_does_not_exist 'hostname.com/action_caching_test/destroy'0
+ assert
!fragment_exist?('hostname.com/action_caching_test/destroy')0
@@ -254,7 +254,7 @@ class ActionCacheTest < Test::Unit::TestCase
0
cached_time = content_to_cache
0
assert_not_equal cached_time, @response.body
0
- assert
_cache_exists 'hostname.com/action_caching_test/with_layout'0
+ assert
fragment_exist?('hostname.com/action_caching_test/with_layout')0
@@ -266,14 +266,14 @@ class ActionCacheTest < Test::Unit::TestCase
0
def test_action_cache_conditional_options
0
@request.env['HTTP_ACCEPT'] = 'application/json'
0
- assert
_cache_does_not_exist 'hostname.com/action_caching_test'0
+ assert
!fragment_exist?('hostname.com/action_caching_test')0
def test_action_cache_with_custom_cache_path
0
cached_time = content_to_cache
0
assert_equal cached_time, @response.body
0
- assert
_cache_exists 'test.host/custom/show'0
+ assert
fragment_exist?('test.host/custom/show')0
@@ -282,11 +282,11 @@ class ActionCacheTest < Test::Unit::TestCase
0
def test_action_cache_with_custom_cache_path_in_block
0
- assert
_cache_exists 'test.host/edit'0
+ assert
fragment_exist?('test.host/edit')0
- assert
_cache_exists 'test.host/1;edit'0
+ assert
fragment_exist?('test.host/1;edit')0
def test_cache_expiration
0
@@ -395,18 +395,8 @@ class ActionCacheTest < Test::Unit::TestCase
0
@request.host = 'hostname.com'
0
- def assert_cache_exists(path)
0
- full_path = cache_path(path)
0
- assert File.exist?(full_path), "#{full_path.inspect} does not exist."
0
- def assert_cache_does_not_exist(path)
0
- full_path = cache_path(path)
0
- assert !File.exist?(full_path), "#{full_path.inspect} should not exist."
0
- File.join(FILE_STORE_PATH, 'views', path + '.cache')
0
+ def fragment_exist?(path)
0
+ @controller.fragment_exist?(path)
0
def read_fragment(path)
0
@@ -450,6 +440,19 @@ class FragmentCachingTest < Test::Unit::TestCase
0
assert_nil @controller.read_fragment('name')
0
+ def test_fragment_exist__with_caching_enabled
0
+ @store.write('views/name', 'value')
0
+ assert @controller.fragment_exist?('name')
0
+ assert !@controller.fragment_exist?('other_name')
0
+ def test_fragment_exist__with_caching_disabled
0
+ ActionController::Base.perform_caching = false
0
+ @store.write('views/name', 'value')
0
+ assert !@controller.fragment_exist?('name')
0
+ assert !@controller.fragment_exist?('other_name')
0
def test_write_fragment__with_caching_enabled
0
assert_nil @store.read('views/name')
0
assert_equal 'value', @controller.write_fragment('name', 'value')
0
@@ -494,7 +497,6 @@ class FragmentCachingTest < Test::Unit::TestCase
0
assert_equal 'generated till now -> ', buffer
0
@store.write('views/expensive', 'fragment content')
0
fragment_computed = false