Skip to content
This repository
Browse code

Don't mutate the original inflections instance in the tests

  • Loading branch information...
commit 2d53ee0f42e917e94d6440ec5370c049b0864814 1 parent 0423d9c
Andrew White pixeltrix authored
41 activesupport/test/inflector_test.rb
@@ -419,33 +419,36 @@ def test_clear_with_default
419 419 end
420 420 end
421 421
422   - Irregularities.each do |irregularity|
423   - singular, plural = *irregularity
424   - ActiveSupport::Inflector.inflections do |inflect|
425   - define_method("test_irregularity_between_#{singular}_and_#{plural}") do
426   - inflect.irregular(singular, plural)
427   - assert_equal singular, ActiveSupport::Inflector.singularize(plural)
428   - assert_equal plural, ActiveSupport::Inflector.pluralize(singular)
  422 + Irregularities.each do |singular, plural|
  423 + define_method("test_irregularity_between_#{singular}_and_#{plural}") do
  424 + with_dup do
  425 + ActiveSupport::Inflector.inflections do |inflect|
  426 + inflect.irregular(singular, plural)
  427 + assert_equal singular, ActiveSupport::Inflector.singularize(plural)
  428 + assert_equal plural, ActiveSupport::Inflector.pluralize(singular)
  429 + end
429 430 end
430 431 end
431 432 end
432 433
433   - Irregularities.each do |irregularity|
434   - singular, plural = *irregularity
435   - ActiveSupport::Inflector.inflections do |inflect|
436   - define_method("test_pluralize_of_irregularity_#{plural}_should_be_the_same") do
437   - inflect.irregular(singular, plural)
438   - assert_equal plural, ActiveSupport::Inflector.pluralize(plural)
  434 + Irregularities.each do |singular, plural|
  435 + define_method("test_pluralize_of_irregularity_#{plural}_should_be_the_same") do
  436 + with_dup do
  437 + ActiveSupport::Inflector.inflections do |inflect|
  438 + inflect.irregular(singular, plural)
  439 + assert_equal plural, ActiveSupport::Inflector.pluralize(plural)
  440 + end
439 441 end
440 442 end
441 443 end
442 444
443   - Irregularities.each do |irregularity|
444   - singular, plural = *irregularity
445   - ActiveSupport::Inflector.inflections do |inflect|
446   - define_method("test_singularize_of_irregularity_#{singular}_should_be_the_same") do
447   - inflect.irregular(singular, plural)
448   - assert_equal singular, ActiveSupport::Inflector.singularize(singular)
  445 + Irregularities.each do |singular, plural|
  446 + define_method("test_singularize_of_irregularity_#{singular}_should_be_the_same") do
  447 + with_dup do
  448 + ActiveSupport::Inflector.inflections do |inflect|
  449 + inflect.irregular(singular, plural)
  450 + assert_equal singular, ActiveSupport::Inflector.singularize(singular)
  451 + end
449 452 end
450 453 end
451 454 end
1  activesupport/test/inflector_test_cases.rb
@@ -105,7 +105,6 @@ module InflectorTestCases
105 105 "prize" => "prizes",
106 106 "edge" => "edges",
107 107
108   - "cow" => "kine",
109 108 "database" => "databases",
110 109
111 110 # regression tests against improper inflection regexes

0 comments on commit 2d53ee0

Please sign in to comment.
Something went wrong with that request. Please try again.