Methods
S
T
Instance Public methods
setup()
# File rails/actionpack/test/controller/caching_test.rb, line 134
def setup
  reset!
  FileUtils.mkdir_p(FILE_STORE_PATH)
  @path_class = ActionController::Caching::Actions::ActionCachePath
  @mock_controller = ActionCachingMockController.new
end
teardown()
# File rails/actionpack/test/controller/caching_test.rb, line 141
def teardown
  FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
end
test_cache_expiration()
# File rails/actionpack/test/controller/caching_test.rb, line 155
def test_cache_expiration
  get :index
  cached_time = content_to_cache
  reset!

  get :index
  assert_equal cached_time, @response.body
  reset!

  get :expire
  reset!

  get :index
  new_cached_time = content_to_cache
  assert_not_equal cached_time, @response.body
  reset!

  get :index
  assert_response :success
  assert_equal new_cached_time, @response.body
end
test_cache_is_scoped_by_subdomain()
# File rails/actionpack/test/controller/caching_test.rb, line 177
def test_cache_is_scoped_by_subdomain
  @request.host = 'jamis.hostname.com'
  get :index
  jamis_cache = content_to_cache

  @request.host = 'david.hostname.com'
  get :index
  david_cache = content_to_cache
  assert_not_equal jamis_cache, @response.body

  @request.host = 'jamis.hostname.com'
  get :index
  assert_equal jamis_cache, @response.body

  @request.host = 'david.hostname.com'
  get :index
  assert_equal david_cache, @response.body
end
test_empty_path_is_normalized()
# File rails/actionpack/test/controller/caching_test.rb, line 204
def test_empty_path_is_normalized
  @mock_controller.mock_url_for = 'http://example.org/'
  @mock_controller.mock_path    = '/'

  assert_equal 'example.org/index', @path_class.path_for(@mock_controller, {})
end
test_file_extensions()
# File rails/actionpack/test/controller/caching_test.rb, line 211
def test_file_extensions
  get :index, :id => 'kitten.jpg'
  get :index, :id => 'kitten.jpg'

  assert_response :success
end
test_simple_action_cache()
# File rails/actionpack/test/controller/caching_test.rb, line 145
def test_simple_action_cache
  get :index
  cached_time = content_to_cache
  assert_equal cached_time, @response.body
  reset!

  get :index
  assert_equal cached_time, @response.body
end
test_xml_version_of_resource_is_treated_as_different_cache()
# File rails/actionpack/test/controller/caching_test.rb, line 196
def test_xml_version_of_resource_is_treated_as_different_cache
  @mock_controller.mock_url_for = 'http://example.org/posts/'
  @mock_controller.mock_path    = '/posts/index.xml'
  path_object = @path_class.new(@mock_controller, {})
  assert_equal 'xml', path_object.extension
  assert_equal 'example.org/posts/index.xml', path_object.path
end