diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-24 11:39:37 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-24 11:40:22 +0200 |
commit | e061a12a156791c35bba092263ad216b1b938502 (patch) | |
tree | 465238f47d1929b407ccac692b761d252c4f5ce2 /railties/test | |
parent | 5eb3b4d9a78268753d009404810619cf93cf6581 (diff) | |
download | rails-e061a12a156791c35bba092263ad216b1b938502.tar.gz rails-e061a12a156791c35bba092263ad216b1b938502.tar.bz2 rails-e061a12a156791c35bba092263ad216b1b938502.zip |
Remove run_initializers from class methods.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/initializable_test.rb | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index 74301a5dc5..72c35879c5 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -5,10 +5,7 @@ module InitializableTests class Foo include Rails::Initializable - - class << self - attr_accessor :foo, :bar - end + attr_accessor :foo, :bar initializer :start do @foo ||= 0 @@ -158,30 +155,22 @@ module InitializableTests include ActiveSupport::Testing::Isolation test "initializers run" do - Foo.run_initializers - assert_equal 1, Foo.foo + foo = Foo.new + foo.run_initializers + assert_equal 1, foo.foo end test "initializers are inherited" do - Bar.run_initializers - assert_equal [1, 1], [Bar.foo, Bar.bar] + bar = Bar.new + bar.run_initializers + assert_equal [1, 1], [bar.foo, bar.bar] end test "initializers only get run once" do - Foo.run_initializers - Foo.run_initializers - assert_equal 1, Foo.foo - end - - test "running initializers on children does not effect the parent" do - Bar.run_initializers - assert_nil Foo.foo - assert_nil Foo.bar - end - - test "initializing with modules" do - Word.run_initializers - assert_equal "bird", $word + foo = Foo.new + foo.run_initializers + foo.run_initializers + assert_equal 1, foo.foo end test "creating initializer without a block raises an error" do @@ -198,19 +187,19 @@ module InitializableTests class BeforeAfter < ActiveSupport::TestCase test "running on parent" do $arr = [] - Parent.run_initializers + Parent.new.run_initializers assert_equal [5, 1, 2], $arr end test "running on child" do $arr = [] - Child.run_initializers + Child.new.run_initializers assert_equal [5, 3, 1, 4, 2], $arr end test "handles dependencies introduced before all initializers are loaded" do $arr = [] - Interdependent::Application.run_initializers + Interdependent::Application.new.run_initializers assert_equal [1, 2, 3, 4], $arr end end |