diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-24 08:56:16 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-24 08:56:16 -0700 |
commit | 2c571b3f0544a6457db4818e752f4cd4bacd48b4 (patch) | |
tree | a7dae21847d456a9ac713c4b93de0546201a6100 /activesupport | |
parent | 6a70f2dd6b791c3f4888122d5b7dd9c8f5cac871 (diff) | |
parent | 73f0afd1d41aa6c3febcc2e93e4d19d9bf0f27dc (diff) | |
download | rails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.tar.gz rails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.tar.bz2 rails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.zip |
Merge pull request #7058 from frodsan/fix_as_random_tests
Fix tests that depend on run order
Diffstat (limited to 'activesupport')
4 files changed, 23 insertions, 14 deletions
diff --git a/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb b/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb index ef66ddaac7..402609c583 100644 --- a/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +++ b/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb @@ -1,3 +1,3 @@ class ClassFolder::ClassFolderSubclass < ClassFolder - ConstantInClassFolder + ConstantInClassFolder = 'indeed' end diff --git a/activesupport/test/core_ext/module/qualified_const_test.rb b/activesupport/test/core_ext/module/qualified_const_test.rb index 8af0b9a023..343a848a42 100644 --- a/activesupport/test/core_ext/module/qualified_const_test.rb +++ b/activesupport/test/core_ext/module/qualified_const_test.rb @@ -67,17 +67,24 @@ class QualifiedConstTest < ActiveSupport::TestCase end test "qualified_const_set" do - m = Module.new - assert_equal m, Object.qualified_const_set("QualifiedConstTestMod2", m) - assert_equal m, ::QualifiedConstTestMod2 - - # We are going to assign to existing constants on purpose, so silence warnings. - silence_warnings do - assert_equal true, QualifiedConstTestMod.qualified_const_set("QualifiedConstTestMod::X", true) - assert_equal true, QualifiedConstTestMod::X - - assert_equal 10, QualifiedConstTestMod::M.qualified_const_set("X", 10) - assert_equal 10, QualifiedConstTestMod::M::X + begin + m = Module.new + assert_equal m, Object.qualified_const_set("QualifiedConstTestMod2", m) + assert_equal m, ::QualifiedConstTestMod2 + + # We are going to assign to existing constants on purpose, so silence warnings. + silence_warnings do + assert_equal true, QualifiedConstTestMod.qualified_const_set("QualifiedConstTestMod::X", true) + assert_equal true, QualifiedConstTestMod::X + + assert_equal 10, QualifiedConstTestMod::M.qualified_const_set("X", 10) + assert_equal 10, QualifiedConstTestMod::M::X + end + ensure + silence_warnings do + QualifiedConstTestMod.qualified_const_set('QualifiedConstTestMod::X', false) + QualifiedConstTestMod::M.qualified_const_set('X', 1) + end end end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 69829bcda5..f1da6378a7 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -679,6 +679,8 @@ class DependenciesTest < ActiveSupport::TestCase assert_equal true, M.unloadable assert_equal false, M.unloadable end + ensure + Object.class_eval { remove_const :M } end def test_unloadable_constants_should_receive_callback diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index cd91002147..aa41e57928 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -169,11 +169,11 @@ class InflectorTest < ActiveSupport::TestCase def test_underscore_acronym_sequence ActiveSupport::Inflector.inflections do |inflect| inflect.acronym("API") - inflect.acronym("HTML5") + inflect.acronym("JSON") inflect.acronym("HTML") end - assert_equal("html5_html_api", ActiveSupport::Inflector.underscore("HTML5HTMLAPI")) + assert_equal("json_html_api", ActiveSupport::Inflector.underscore("JSONHTMLAPI")) end def test_underscore |