Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix randomly failing unit test spotted in pull request #2633 #2634

Closed

Conversation

jremes-foss
Copy link
Contributor

Summary

Unit test in line 153 of test_ja_locale.rb was failing randomly. Reason for this failure was Latin character in Japanese localisation.

Line 153 says:

assert_not_english(Faker::Games::SuperMario.character)

This method is as follows:

def assert_not_english(word)
  assert_not_match(/[a-zA-Z]/, word)
end

Basically, this is to say, the unit test use Regex match to test for Latin alphabet and will fail with every Latin alphabet. I had a look and noticed an interesting element in characters array of super_mario in Japanese localisation, lib/locales/ja/super_mario.yml:

クッパJr.

I isolated the test case into an array of single element and noticed that this was the problematic element which caused the unit test to fail.

I removed the element, as the assert_not_match requires strict Latin alphabet.

This should let @alextaujenis to uncomment the line. As a further suggestion, maybe there should be YML check which checks for Latin characters for future generators which are using assert_not_english method in unit tests. If Latin character is spotted, fail the test.

Thanks,
Juha

@jremes-foss
Copy link
Contributor Author

Closing this as redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant