aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-07-14 16:01:28 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-08-23 16:00:58 -0500
commitcc14a3b2c1d5684c88355230faa263515358776d (patch)
tree26b651227c79a1869a9dca775b64e4b862b1b307 /activesupport
parente8afb84b13fc7c2fe1467ed88e1f8b5144eac4a1 (diff)
downloadrails-cc14a3b2c1d5684c88355230faa263515358776d.tar.gz
rails-cc14a3b2c1d5684c88355230faa263515358776d.tar.bz2
rails-cc14a3b2c1d5684c88355230faa263515358776d.zip
Fix ActiveSupport tests that depend on run order
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb2
-rw-r--r--activesupport/test/core_ext/module/qualified_const_test.rb29
-rw-r--r--activesupport/test/dependencies_test.rb2
-rw-r--r--activesupport/test/inflector_test.rb4
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