diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-12 17:48:30 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-12 17:48:30 -0500 |
commit | ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1 (patch) | |
tree | a3cce25be0c613a8e1444e1d0ff53aaed3497057 /railties/test/initializer_test.rb | |
parent | 556204abaf95f7c995576cb1358f13de406682ab (diff) | |
parent | dd4181f47dc0f166eb5d3e47a4a0dc1594cc5669 (diff) | |
download | rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.gz rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.bz2 rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'railties/test/initializer_test.rb')
-rw-r--r-- | railties/test/initializer_test.rb | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/railties/test/initializer_test.rb b/railties/test/initializer_test.rb index efce4f292d..dee7abe05f 100644 --- a/railties/test/initializer_test.rb +++ b/railties/test/initializer_test.rb @@ -30,66 +30,66 @@ class Initializer_load_environment_Test < Test::Unit::TestCase end -class Initializer_after_initialize_with_blocks_environment_Test < Test::Unit::TestCase - def setup - config = ConfigurationMock.new("") - config.after_initialize do - $test_after_initialize_block1 = "success" - end - config.after_initialize do - $test_after_initialize_block2 = "congratulations" - end - assert_nil $test_after_initialize_block1 - assert_nil $test_after_initialize_block2 +uses_mocha 'Initializer after_initialize' do + class Initializer_after_initialize_with_blocks_environment_Test < Test::Unit::TestCase + def setup + config = ConfigurationMock.new("") + config.after_initialize do + $test_after_initialize_block1 = "success" + end + config.after_initialize do + $test_after_initialize_block2 = "congratulations" + end + assert_nil $test_after_initialize_block1 + assert_nil $test_after_initialize_block2 - Rails::Initializer.any_instance.expects(:gems_dependencies_loaded).returns(true) - Rails::Initializer.run(:after_initialize, config) - end + Rails::Initializer.any_instance.expects(:gems_dependencies_loaded).returns(true) + Rails::Initializer.run(:after_initialize, config) + end - def teardown - $test_after_initialize_block1 = nil - $test_after_initialize_block2 = nil - end + def teardown + $test_after_initialize_block1 = nil + $test_after_initialize_block2 = nil + end - def test_should_have_called_the_first_after_initialize_block - assert_equal "success", $test_after_initialize_block1 - end + def test_should_have_called_the_first_after_initialize_block + assert_equal "success", $test_after_initialize_block1 + end - def test_should_have_called_the_second_after_initialize_block - assert_equal "congratulations", $test_after_initialize_block2 + def test_should_have_called_the_second_after_initialize_block + assert_equal "congratulations", $test_after_initialize_block2 + end end -end -class Initializer_after_initialize_with_no_block_environment_Test < Test::Unit::TestCase + class Initializer_after_initialize_with_no_block_environment_Test < Test::Unit::TestCase + def setup + config = ConfigurationMock.new("") + config.after_initialize do + $test_after_initialize_block1 = "success" + end + config.after_initialize # don't pass a block, this is what we're testing! + config.after_initialize do + $test_after_initialize_block2 = "congratulations" + end + assert_nil $test_after_initialize_block1 - def setup - config = ConfigurationMock.new("") - config.after_initialize do - $test_after_initialize_block1 = "success" + Rails::Initializer.any_instance.expects(:gems_dependencies_loaded).returns(true) + Rails::Initializer.run(:after_initialize, config) end - config.after_initialize # don't pass a block, this is what we're testing! - config.after_initialize do - $test_after_initialize_block2 = "congratulations" - end - assert_nil $test_after_initialize_block1 - - Rails::Initializer.any_instance.expects(:gems_dependencies_loaded).returns(true) - Rails::Initializer.run(:after_initialize, config) - end - def teardown - $test_after_initialize_block1 = nil - $test_after_initialize_block2 = nil - end + def teardown + $test_after_initialize_block1 = nil + $test_after_initialize_block2 = nil + end - def test_should_have_called_the_first_after_initialize_block - assert_equal "success", $test_after_initialize_block1, "should still get set" - end + def test_should_have_called_the_first_after_initialize_block + assert_equal "success", $test_after_initialize_block1, "should still get set" + end - def test_should_have_called_the_second_after_initialize_block - assert_equal "congratulations", $test_after_initialize_block2 + def test_should_have_called_the_second_after_initialize_block + assert_equal "congratulations", $test_after_initialize_block2 + end end - end uses_mocha 'framework paths' do @@ -173,7 +173,7 @@ uses_mocha "Initializer plugin loading tests" do def test_all_plugins_are_loaded_when_registered_plugin_list_is_untouched failure_tip = "It's likely someone has added a new plugin fixture without updating this list" load_plugins! - assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @initializer.loaded_plugins, failure_tip + assert_plugins [:a, :acts_as_chunky_bacon, :gemlike, :plugin_with_no_lib_dir, :stubby], @initializer.loaded_plugins, failure_tip end def test_all_plugins_loaded_when_all_is_used @@ -181,7 +181,7 @@ uses_mocha "Initializer plugin loading tests" do only_load_the_following_plugins! plugin_names load_plugins! failure_tip = "It's likely someone has added a new plugin fixture without updating this list" - assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :plugin_with_no_lib_dir], @initializer.loaded_plugins, failure_tip + assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :gemlike, :plugin_with_no_lib_dir], @initializer.loaded_plugins, failure_tip end def test_all_plugins_loaded_after_all @@ -189,7 +189,7 @@ uses_mocha "Initializer plugin loading tests" do only_load_the_following_plugins! plugin_names load_plugins! failure_tip = "It's likely someone has added a new plugin fixture without updating this list" - assert_plugins [:stubby, :a, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @initializer.loaded_plugins, failure_tip + assert_plugins [:stubby, :a, :gemlike, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @initializer.loaded_plugins, failure_tip end def test_plugin_names_may_be_strings |