diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-07-30 12:01:56 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-07-30 12:01:56 +0100 |
commit | 2d53ee0f42e917e94d6440ec5370c049b0864814 (patch) | |
tree | 1a0f545542bc980f47c064fef5e49d37a43d1a7b /activesupport/test | |
parent | 0423d9c6c57ffac7f0368460277f370b35c86d64 (diff) | |
download | rails-2d53ee0f42e917e94d6440ec5370c049b0864814.tar.gz rails-2d53ee0f42e917e94d6440ec5370c049b0864814.tar.bz2 rails-2d53ee0f42e917e94d6440ec5370c049b0864814.zip |
Don't mutate the original inflections instance in the tests
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/inflector_test.rb | 41 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 1 |
2 files changed, 22 insertions, 20 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 22cb61ffd6..f3bf29881c 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -419,33 +419,36 @@ class InflectorTest < ActiveSupport::TestCase end end - Irregularities.each do |irregularity| - singular, plural = *irregularity - ActiveSupport::Inflector.inflections do |inflect| - define_method("test_irregularity_between_#{singular}_and_#{plural}") do - inflect.irregular(singular, plural) - assert_equal singular, ActiveSupport::Inflector.singularize(plural) - assert_equal plural, ActiveSupport::Inflector.pluralize(singular) + Irregularities.each do |singular, plural| + define_method("test_irregularity_between_#{singular}_and_#{plural}") do + with_dup do + ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular(singular, plural) + assert_equal singular, ActiveSupport::Inflector.singularize(plural) + assert_equal plural, ActiveSupport::Inflector.pluralize(singular) + end end end end - Irregularities.each do |irregularity| - singular, plural = *irregularity - ActiveSupport::Inflector.inflections do |inflect| - define_method("test_pluralize_of_irregularity_#{plural}_should_be_the_same") do - inflect.irregular(singular, plural) - assert_equal plural, ActiveSupport::Inflector.pluralize(plural) + Irregularities.each do |singular, plural| + define_method("test_pluralize_of_irregularity_#{plural}_should_be_the_same") do + with_dup do + ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular(singular, plural) + assert_equal plural, ActiveSupport::Inflector.pluralize(plural) + end end end end - Irregularities.each do |irregularity| - singular, plural = *irregularity - ActiveSupport::Inflector.inflections do |inflect| - define_method("test_singularize_of_irregularity_#{singular}_should_be_the_same") do - inflect.irregular(singular, plural) - assert_equal singular, ActiveSupport::Inflector.singularize(singular) + Irregularities.each do |singular, plural| + define_method("test_singularize_of_irregularity_#{singular}_should_be_the_same") do + with_dup do + ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular(singular, plural) + assert_equal singular, ActiveSupport::Inflector.singularize(singular) + end end end end diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index 7704300938..cc36d62138 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -105,7 +105,6 @@ module InflectorTestCases "prize" => "prizes", "edge" => "edges", - "cow" => "kine", "database" => "databases", # regression tests against improper inflection regexes |