Skip to content

Commit 9e15560

Browse files
committed
Failing test for lazy translation in partial with block
1 parent be0ab85 commit 9e15560

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<%= t('.foo') %>
2+
<%= yield %>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= render("translations/templates/partial") %>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<%= render("translations/templates/partial") do %>
2+
<% end %>

actionview/test/template/translation_helper_test.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class TranslationHelperTest < ActiveSupport::TestCase
2323
found_yield_single_argument: { foo: "Foo" },
2424
found_yield_block: { foo: "Foo" },
2525
array: { foo: { bar: "Foo Bar" } },
26-
default: { foo: "Foo" }
26+
default: { foo: "Foo" },
27+
partial: { foo: "Partial foo" }
2728
},
2829
foo: "Foo",
2930
hello: "<a>Hello World</a>",
@@ -176,6 +177,14 @@ def test_finds_translation_scoped_by_partial_yielding_single_argument_block
176177
assert_equal "Foo", view.render(template: "translations/templates/found_yield_single_argument").strip
177178
end
178179

180+
def test_finds_lazy_translation_scoped_by_partial
181+
assert_equal "Partial foo", view.render(template: "translations/templates/partial_lazy_translation").strip
182+
end
183+
184+
def test_finds_lazy_translation_scoped_by_partial_with_block
185+
assert_equal "Partial foo", view.render(template: "translations/templates/partial_lazy_translation_block").strip
186+
end
187+
179188
def test_finds_translation_scoped_by_partial_yielding_translation_and_key
180189
assert_equal "translations.templates.found_yield_block.foo: Foo", view.render(template: "translations/templates/found_yield_block").strip
181190
end

0 commit comments

Comments
 (0)