Skip to content

Commit

Permalink
Correct translation missing assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed May 31, 2023
1 parent 76bac48 commit 62818cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 7 additions & 1 deletion test/backend/fallbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ def setup
end

test "returns the Translation missing: message if the default is also missing" do
assert_equal 'Translation missing: de-DE.missing_bar', I18n.t(:missing_bar, :locale => :'de-DE', :default => [:missing_baz])
translation_missing_message = <<~MSG
Translation missing. Options considered were:
- de-DE.missing_bar
- de-DE.missing_baz
MSG

assert_equal translation_missing_message.chomp, I18n.t(:missing_bar, :locale => :'de-DE', :default => [:missing_baz])
end

test "returns the :'de-DE' default :baz translation for a missing :'de-DE' when defaults contains Symbol" do
Expand Down
8 changes: 1 addition & 7 deletions test/i18n/exceptions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ def test_invalid_locale_stores_locale

test "MissingTranslationData message contains the locale and scoped key" do
force_missing_translation_data do |exception|
assert_equal 'Translation missing: de.bar.foo', exception.message
end
end

test "MissingTranslationData message contains all potential options" do
force_missing_translation_data(default: [:option_a, :option_b]) do |exception|
assert_equal "Translation missing:. Options considered were:\n- de.bar.option_a, \n- de.bar.option_a", exception.message
assert_equal 'translation missing: de.bar.foo', exception.message
end
end

Expand Down

0 comments on commit 62818cf

Please sign in to comment.