diff options
author | Gaurish Sharma <contact@gaurishsharma.com> | 2013-08-03 18:21:17 +0530 |
---|---|---|
committer | Gaurish Sharma <contact@gaurishsharma.com> | 2013-08-03 18:21:17 +0530 |
commit | ab5e99ed63e7b2cec5a4e8b36c349b02f414025b (patch) | |
tree | 8450add82eae72581dcffc4be81cef1c5f56abfc /activesupport/test | |
parent | 71f512646a447e4b15c613d35842728e6b8dddb1 (diff) | |
download | rails-ab5e99ed63e7b2cec5a4e8b36c349b02f414025b.tar.gz rails-ab5e99ed63e7b2cec5a4e8b36c349b02f414025b.tar.bz2 rails-ab5e99ed63e7b2cec5a4e8b36c349b02f414025b.zip |
Avoid calling define_method with non-english chars in InflectorTest
When we call define_method with non-english chars like ¿por qué? it
errors out on JRuby as of 1.7.4 & would leave out the following error
invalid byte sequence in US-ASCII
To work around this issue, I have switched to define_test method call
define method with fixed string & the index of the hash. the index was
added because otherwise, ruby will raise method redefined warning.
As far as I can see there are no side-effect of this change for
other implementations. For readbility I have added a message to
asssert_equal informing for which word/phase the test has passed.
Before this Change:
JRuby:
Tests terminated suddenly with an error. no reported of Failues
or errors
MRI:
All Green.
After this Change,
JRuby:
the `ActiveSupport` TestsSuite gracefully fails with report at the end which test failed & why.
MRI:
All Green(no change)
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/inflector_test.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index f3bf29881c..1bb2d7e920 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -76,9 +76,10 @@ class InflectorTest < ActiveSupport::TestCase ActiveSupport::Inflector.inflections.uncountable "series" # Return to normal end - MixtureToTitleCase.each do |before, titleized| - define_method "test_titleize_#{before}" do - assert_equal(titleized, ActiveSupport::Inflector.titleize(before)) + MixtureToTitleCase.each_with_index do |(before, titleized), index| + define_method "test_titleize_mixture_to_title_case_#{index}" do + assert_equal(titleized, ActiveSupport::Inflector.titleize(before), "mixture \ + to TitleCase failed for #{before}") end end |