File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
lib/action_controller/metal Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def determine_template_etag(options)
4444 # template digest from the ETag.
4545 def pick_template_for_etag ( options )
4646 unless options [ :template ] == false
47- options [ :template ] || " #{ controller_path } / #{ action_name } "
47+ options [ :template ] || lookup_context . find_all ( action_name , _prefixes ) . first &. virtual_path
4848 end
4949 end
5050
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ def hello_world
6666 end
6767end
6868
69+ class InheritedRenderTestController < ImplicitRenderTestController
70+ def hello_world
71+ fresh_when ( etag : "abc" )
72+ end
73+ end
74+
6975class TestController < ActionController ::Base
7076 protect_from_forgery
7177
@@ -677,6 +683,28 @@ def test_etag_reflects_template_digest
677683 end
678684end
679685
686+ class InheritedEtagRenderTest < ActionController ::TestCase
687+ tests InheritedRenderTestController
688+ include TemplateModificationHelper
689+
690+ def test_etag_reflects_template_digest
691+ get :hello_world
692+ assert_response :ok
693+ assert_not_nil etag = @response . etag
694+
695+ request . if_none_match = etag
696+ get :hello_world
697+ assert_response :not_modified
698+
699+ modify_template ( "implicit_render_test/hello_world" ) do
700+ request . if_none_match = etag
701+ get :hello_world
702+ assert_response :ok
703+ assert_not_equal etag , @response . etag
704+ end
705+ end
706+ end
707+
680708class MetalRenderTest < ActionController ::TestCase
681709 tests MetalTestController
682710
You can’t perform that action at this time.
0 commit comments