Methods
- S
- T
-
- teardown,
- test_action_cache_conditional_options,
- test_action_cache_with_custom_cache_path,
- test_action_cache_with_custom_cache_path_in_block,
- test_action_cache_with_format_and_http_param,
- test_action_cache_with_layout,
- test_action_cache_with_layout_and_layout_cache_false,
- test_action_cache_with_store_options,
- test_action_caching_plus_streaming,
- test_cache_expiration,
- test_cache_expiration_isnt_affected_by_request_format,
- test_cache_expiration_with_url_string,
- test_cache_is_scoped_by_subdomain,
- test_correct_content_type_is_returned_for_cache_hit,
- test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key,
- test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key_from_proc,
- test_empty_path_is_normalized,
- test_file_extensions,
- test_forbidden_is_not_cached,
- test_four_oh_four_renders_content,
- test_four_oh_four_returns_404_for_multiple_requests,
- test_record_not_found_returns_404_for_multiple_requests,
- test_redirect_is_not_cached,
- test_simple_action_cache,
- test_simple_action_not_cached,
- test_simple_runtime_error_returns_500_for_multiple_requests,
- test_xml_version_of_resource_is_treated_as_different_cache
Included Modules
Instance Public methods
setup()
Link
teardown()
Link
test_action_cache_conditional_options()
Link
test_action_cache_with_custom_cache_path()
Link
# File actionpack/test/controller/caching_test.rb, line 433 def test_action_cache_with_custom_cache_path get :show assert_response :success cached_time = content_to_cache assert_equal cached_time, @response.body assert fragment_exist?('test.host/custom/show') reset! get :show assert_response :success assert_equal cached_time, @response.body end
test_action_cache_with_custom_cache_path_in_block()
Link
# File actionpack/test/controller/caching_test.rb, line 446 def test_action_cache_with_custom_cache_path_in_block get :edit assert_response :success assert fragment_exist?('test.host/edit') reset! get :edit, :id => 1 assert_response :success assert fragment_exist?('test.host/1;edit') end
test_action_cache_with_format_and_http_param()
Link
# File actionpack/test/controller/caching_test.rb, line 418 def test_action_cache_with_format_and_http_param get :with_format_and_http_param, :format => 'json' assert_response :success assert !fragment_exist?('hostname.com/action_caching_test/with_format_and_http_param.json?key=value.json') assert fragment_exist?('hostname.com/action_caching_test/with_format_and_http_param.json?key=value') end
test_action_cache_with_layout()
Link
# File actionpack/test/controller/caching_test.rb, line 380 def test_action_cache_with_layout get :with_layout assert_response :success cached_time = content_to_cache assert_not_equal cached_time, @response.body assert fragment_exist?('hostname.com/action_caching_test/with_layout') reset! get :with_layout assert_response :success assert_not_equal cached_time, @response.body body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout')) assert_equal @response.body, body end
test_action_cache_with_layout_and_layout_cache_false()
Link
# File actionpack/test/controller/caching_test.rb, line 395 def test_action_cache_with_layout_and_layout_cache_false get :layout_false assert_response :success cached_time = content_to_cache assert_not_equal cached_time, @response.body assert fragment_exist?('hostname.com/action_caching_test/layout_false') reset! get :layout_false assert_response :success assert_not_equal cached_time, @response.body body = body_to_string(read_fragment('hostname.com/action_caching_test/layout_false')) assert_equal cached_time, body end
test_action_cache_with_store_options()
Link
# File actionpack/test/controller/caching_test.rb, line 425 def test_action_cache_with_store_options MockTime.expects(:now).returns(12345).once @controller.expects(:read_fragment).with('hostname.com/action_caching_test', :expires_in => 1.hour).once @controller.expects(:write_fragment).with('hostname.com/action_caching_test', '12345.0', :expires_in => 1.hour).once get :index assert_response :success end
test_action_caching_plus_streaming()
Link
test_cache_expiration()
Link
# File actionpack/test/controller/caching_test.rb, line 457 def test_cache_expiration get :index assert_response :success cached_time = content_to_cache reset! get :index assert_response :success assert_equal cached_time, @response.body reset! get :expire assert_response :success reset! get :index assert_response :success 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_expiration_isnt_affected_by_request_format()
Link
# File actionpack/test/controller/caching_test.rb, line 483 def test_cache_expiration_isnt_affected_by_request_format get :index cached_time = content_to_cache reset! @request.request_uri = "/action_caching_test/expire.xml" get :expire, :format => :xml assert_response :success reset! get :index assert_response :success assert_not_equal cached_time, @response.body end
test_cache_expiration_with_url_string()
Link
# File actionpack/test/controller/caching_test.rb, line 498 def test_cache_expiration_with_url_string get :index cached_time = content_to_cache reset! @request.request_uri = "/action_caching_test/expire_with_url_string" get :expire_with_url_string assert_response :success reset! get :index assert_response :success assert_not_equal cached_time, @response.body end
test_cache_is_scoped_by_subdomain()
Link
# File actionpack/test/controller/caching_test.rb, line 513 def test_cache_is_scoped_by_subdomain @request.host = 'jamis.hostname.com' get :index assert_response :success jamis_cache = content_to_cache reset! @request.host = 'david.hostname.com' get :index assert_response :success david_cache = content_to_cache assert_not_equal jamis_cache, @response.body reset! @request.host = 'jamis.hostname.com' get :index assert_response :success assert_equal jamis_cache, @response.body reset! @request.host = 'david.hostname.com' get :index assert_response :success assert_equal david_cache, @response.body end
test_correct_content_type_is_returned_for_cache_hit()
Link
# File actionpack/test/controller/caching_test.rb, line 589 def test_correct_content_type_is_returned_for_cache_hit # run it twice to cache it the first time get :index, :id => 'content-type', :format => 'xml' get :index, :id => 'content-type', :format => 'xml' assert_response :success assert_equal 'application/xml', @response.content_type end
test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key()
Link
# File actionpack/test/controller/caching_test.rb, line 597 def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key # run it twice to cache it the first time get :show, :format => 'xml' get :show, :format => 'xml' assert_response :success assert_equal 'application/xml', @response.content_type end
test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key_from_proc()
Link
# File actionpack/test/controller/caching_test.rb, line 605 def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key_from_proc # run it twice to cache it the first time get :edit, :id => 1, :format => 'xml' get :edit, :id => 1, :format => 'xml' assert_response :success assert_equal 'application/xml', @response.content_type end
test_empty_path_is_normalized()
Link
test_file_extensions()
Link
test_forbidden_is_not_cached()
Link
test_four_oh_four_renders_content()
Link
test_four_oh_four_returns_404_for_multiple_requests()
Link
test_record_not_found_returns_404_for_multiple_requests()
Link
test_redirect_is_not_cached()
Link
test_simple_action_cache()
Link
# File actionpack/test/controller/caching_test.rb, line 352 def test_simple_action_cache get :index assert_response :success cached_time = content_to_cache assert_equal cached_time, @response.body assert fragment_exist?('hostname.com/action_caching_test') reset! get :index assert_response :success assert_equal cached_time, @response.body end
test_simple_action_not_cached()
Link
# File actionpack/test/controller/caching_test.rb, line 365 def test_simple_action_not_cached get :destroy assert_response :success cached_time = content_to_cache assert_equal cached_time, @response.body assert !fragment_exist?('hostname.com/action_caching_test/destroy') reset! get :destroy assert_response :success assert_not_equal cached_time, @response.body end
test_simple_runtime_error_returns_500_for_multiple_requests()
Link
test_xml_version_of_resource_is_treated_as_different_cache()
Link
# File actionpack/test/controller/caching_test.rb, line 560 def test_xml_version_of_resource_is_treated_as_different_cache with_routing do |set| set.draw do match ':controller(/:action(.:format))' end get :index, :format => 'xml' assert_response :success cached_time = content_to_cache assert_equal cached_time, @response.body assert fragment_exist?('hostname.com/action_caching_test/index.xml') reset! get :index, :format => 'xml' assert_response :success assert_equal cached_time, @response.body assert_equal 'application/xml', @response.content_type reset! get :expire_xml assert_response :success reset! get :index, :format => 'xml' assert_response :success assert_not_equal cached_time, @response.body end end