Skip to content

Commit 9d182d9

Browse files
Fix flaky translation test (#1850)
This replaces the call to a stubbed method with a call to the original method. This should be more reliable and less likely to break during CI runs.
1 parent d1b3707 commit 9d182d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/sandbox/test/translatable_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ def test_translate_uses_the_helper_when_no_sidecar_file_is_provided
7979
# The cache needs to be kept clean for TranslatableComponent, otherwise it will rely on the
8080
# already created i18n_backend.
8181
ViewComponent::CompileCache.invalidate_class!(TranslatableComponent)
82+
original_method = TranslatableComponent.method(:sidecar_files)
8283

8384
ViewComponent::Base.stub(
8485
:sidecar_files,
85-
->(exts) { exts.include?("yml") ? [] : TranslatableComponent.__minitest_stub___sidecar_files(exts) }
86+
->(exts) { exts.include?("yml") ? [] : original_method.call(exts) }
8687
) do
8788
assert_equal "MISSING", translate(".hello", default: "MISSING")
8889
assert_equal "Hello from Rails translations!", translate("hello")

0 commit comments

Comments
 (0)