aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAlberto Almagro <alberto.almagro@rakuten.com>2017-08-16 20:30:35 +0200
committerAlberto Almagro <alberto.almagro@rakuten.com>2017-08-16 21:37:34 +0200
commite15583c32e292acdd595dbf137d1c7cb0ea73e58 (patch)
tree6c375a147d148d86cc22b1c43d8ec0c51dfa5a47 /activesupport/test
parent00a47d58ecb4587510ff3d721a692561abbe3ba2 (diff)
downloadrails-e15583c32e292acdd595dbf137d1c7cb0ea73e58.tar.gz
rails-e15583c32e292acdd595dbf137d1c7cb0ea73e58.tar.bz2
rails-e15583c32e292acdd595dbf137d1c7cb0ea73e58.zip
Pass missing name attribute to execute_hook
Fixes commit 10bf93ef92a70ae511036134290bf0e2de184b5c created to solve issue #30025
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/lazy_load_hooks_test.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/activesupport/test/lazy_load_hooks_test.rb b/activesupport/test/lazy_load_hooks_test.rb
index c161005100..721d44d0c1 100644
--- a/activesupport/test/lazy_load_hooks_test.rb
+++ b/activesupport/test/lazy_load_hooks_test.rb
@@ -22,14 +22,19 @@ class LazyLoadHooksTest < ActiveSupport::TestCase
def test_basic_hook_with_two_registrations_only_once
i = 0
- ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true) do
+ block = proc { i += incr }
+ ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true, &block)
+ ActiveSupport.on_load(:basic_hook_with_two_once) do
i += incr
end
- assert_equal 0, i
- ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2))
+
+ ActiveSupport.on_load(:different_hook, run_once: true, &block)
+ ActiveSupport.run_load_hooks(:different_hook, FakeContext.new(2))
assert_equal 2, i
+ ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2))
+ assert_equal 6, i
ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(5))
- assert_equal 2, i
+ assert_equal 11, i
end
def test_hook_registered_after_run