提交 2d53ee0f 编写于 作者: A Andrew White

Don't mutate the original inflections instance in the tests

上级 0423d9c6
......@@ -419,33 +419,36 @@ def test_clear_with_default
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
......
......@@ -105,7 +105,6 @@ module InflectorTestCases
"prize" => "prizes",
"edge" => "edges",
"cow" => "kine",
"database" => "databases",
# regression tests against improper inflection regexes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册