Rails 2.1
Update to Rails 2.1 final.
This commit is contained in:
parent
fd554cce90
commit
516d6dfac0
257 changed files with 4058 additions and 1933 deletions
|
@ -584,6 +584,12 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
assert_equal [], m
|
||||
end
|
||||
|
||||
def test_new_constants_in_with_illegal_module_name_raises_correct_error
|
||||
assert_raises(NameError) do
|
||||
Dependencies.new_constants_in("Illegal-Name") {}
|
||||
end
|
||||
end
|
||||
|
||||
def test_file_with_multiple_constants_and_require_dependency
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert ! defined?(MultipleConstantFile)
|
||||
|
@ -667,7 +673,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ensure
|
||||
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
|
||||
end
|
||||
|
@ -680,11 +686,20 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ensure
|
||||
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
|
||||
end
|
||||
|
||||
def test_autoload_doesnt_shadow_error_when_mechanism_not_set_to_load
|
||||
with_loading 'autoloading_fixtures' do
|
||||
Dependencies.mechanism = :require
|
||||
2.times do
|
||||
assert_raise(NameError) {"RaisesNameError".constantize}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_autoload_doesnt_shadow_name_error
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it hasn't been referenced yet!"
|
||||
|
@ -708,7 +723,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
ensure
|
||||
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
|
||||
end
|
||||
|
||||
|
||||
def test_remove_constant_handles_double_colon_at_start
|
||||
Object.const_set 'DeleteMe', Module.new
|
||||
DeleteMe.const_set 'OrMe', Module.new
|
||||
|
@ -718,7 +733,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
Dependencies.remove_constant "::DeleteMe"
|
||||
assert ! defined?(DeleteMe)
|
||||
end
|
||||
|
||||
|
||||
def test_load_once_constants_should_not_be_unloaded
|
||||
with_loading 'autoloading_fixtures' do
|
||||
Dependencies.load_once_paths = Dependencies.load_paths
|
||||
|
@ -731,7 +746,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
Dependencies.load_once_paths = []
|
||||
Object.class_eval { remove_const :A if const_defined?(:A) }
|
||||
end
|
||||
|
||||
|
||||
def test_load_once_paths_should_behave_when_recursively_loading
|
||||
with_loading 'dependencies', 'autoloading_fixtures' do
|
||||
Dependencies.load_once_paths = [Dependencies.load_paths.last]
|
||||
|
@ -747,5 +762,4 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
ensure
|
||||
Dependencies.load_once_paths = []
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue