Skip to content

Commit

Permalink
Update test helper to use latest Digestor API
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Mar 21, 2014
1 parent 958199a commit 239c1b3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions actionpack/test/controller/caching_test.rb
Expand Up @@ -197,7 +197,7 @@ def test_fragment_caching
assert_equal expected_body, @response.body

assert_equal "This bit's fragment cached",
@store.read("views/test.host/functional_caching/fragment_cached/#{template_digest("functional_caching/fragment_cached", "html")}")
@store.read("views/test.host/functional_caching/fragment_cached/#{template_digest("functional_caching/fragment_cached")}")
end

def test_fragment_caching_in_partials
Expand All @@ -206,7 +206,7 @@ def test_fragment_caching_in_partials
assert_match(/Old fragment caching in a partial/, @response.body)

assert_match("Old fragment caching in a partial",
@store.read("views/test.host/functional_caching/html_fragment_cached_with_partial/#{template_digest("functional_caching/_partial", "html")}"))
@store.read("views/test.host/functional_caching/html_fragment_cached_with_partial/#{template_digest("functional_caching/_partial")}"))
end

def test_skipping_fragment_cache_digesting
Expand All @@ -224,7 +224,7 @@ def test_render_inline_before_fragment_caching
assert_match(/Some inline content/, @response.body)
assert_match(/Some cached content/, @response.body)
assert_match("Some cached content",
@store.read("views/test.host/functional_caching/inline_fragment_cached/#{template_digest("functional_caching/inline_fragment_cached", "html")}"))
@store.read("views/test.host/functional_caching/inline_fragment_cached/#{template_digest("functional_caching/inline_fragment_cached")}"))
end

def test_html_formatted_fragment_caching
Expand All @@ -235,7 +235,7 @@ def test_html_formatted_fragment_caching
assert_equal expected_body, @response.body

assert_equal "<p>ERB</p>",
@store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached", "html")}")
@store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached")}")
end

def test_xml_formatted_fragment_caching
Expand All @@ -246,7 +246,7 @@ def test_xml_formatted_fragment_caching
assert_equal expected_body, @response.body

assert_equal " <p>Builder</p>\n",
@store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached", "xml")}")
@store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached")}")
end


Expand All @@ -260,12 +260,12 @@ def test_fragment_caching_with_variant
assert_equal expected_body, @response.body

assert_equal "<p>PHONE</p>",
@store.read("views/test.host/functional_caching/formatted_fragment_cached_with_variant/#{template_digest("functional_caching/formatted_fragment_cached_with_variant", :html, :phone)}")
@store.read("views/test.host/functional_caching/formatted_fragment_cached_with_variant/#{template_digest("functional_caching/formatted_fragment_cached_with_variant")}")
end

private
def template_digest(name, format, variant = nil)
ActionView::Digestor.digest(name: name, format: format, variant: variant, finder: @controller.lookup_context)
def template_digest(name)
ActionView::Digestor.digest(name: name, finder: @controller.lookup_context)
end
end

Expand Down

0 comments on commit 239c1b3

Please sign in to comment.