Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8493: render_component_shouldnt_set_etag.diff

File render_component_shouldnt_set_etag.diff, 1.5 kB (added by jsierles, 2 years ago)
  • lib/action_controller/base.rb

    old new  
    496496        assign_default_content_type_and_charset 
    497497 
    498498        response.request = request 
    499         response.prepare! 
     499        response.prepare! unless component_request? 
    500500        response 
    501501      ensure 
    502502        process_cleanup 
  • test/controller/components_test.rb

    old new  
    9696    assert_equal "Ring, ring: Lady of the House, speaking", @response.body 
    9797  end 
    9898 
     99  def test_etag_is_set_for_parent_template_when_calling_from_template 
     100    get :calling_from_template 
     101    expected_etag = etag_for("Ring, ring: Lady of the House, speaking") 
     102    assert_equal expected_etag, @response.headers['ETag'] 
     103  end 
     104 
    99105  def test_internal_calling 
    100106    get :internal_caller 
    101107    assert_equal "Are you there? Yes, ma'am", @response.body 
     
    109115    get :use_flash 
    110116    assert_equal 'no flash', @response.body 
    111117  end 
    112  
     118   
    113119  def test_component_redirect_redirects 
    114120    get :calling_redirected 
    115121 
     
    126132 
    127133    assert_equal "Lady of the House, speaking", @response.body 
    128134  end 
     135   
     136  protected 
     137   
     138  def etag_for(text) 
     139    %("#{Digest::MD5.hexdigest(text)}") 
     140  end 
     141   
    129142end