diff options
Diffstat (limited to 'railties/test/application/initializable_test.rb')
-rw-r--r-- | railties/test/application/initializable_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/application/initializable_test.rb b/railties/test/application/initializable_test.rb new file mode 100644 index 0000000000..38eaec63c0 --- /dev/null +++ b/railties/test/application/initializable_test.rb @@ -0,0 +1,26 @@ +require "isolation/abstract_unit" + +module ApplicationTests + class InitializerTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + end + + test "initializers only ever run once" do + class MyApp < Rails::Application + initializer :counter do + $counter += 1 + end + end + + $counter = 0 + MyApp.initializers[:counter].run + MyApp.initializers[:counter].run + + assert_equal 1, $counter + end + end +end
\ No newline at end of file |