Permalink
Browse files

refactor tests for more points

  • Loading branch information...
tenderlove committed May 8, 2013
1 parent 3df92d9 commit d32b329b7ee5fa58f1f88d6f088fc4c60ed51694
Showing with 5 additions and 4 deletions.
  1. +5 −4 activesupport/test/callbacks_test.rb
@@ -808,6 +808,7 @@ def build_class(callback, n = 10)
include ActiveSupport::Callbacks
define_callbacks :foo
n.times { set_callback :foo, callback }
+ def run; run_callbacks :foo; end
}
end
@@ -816,29 +817,29 @@ def test_class
callback = Class.new {
define_singleton_method(:before) { |o| calls << o }
}
- build_class(callback).new.run_callbacks :foo
+ build_class(callback).new.run
assert_equal 10, calls.length
end
def test_lambda
calls = []
- build_class(->(o) { calls << o }).new.run_callbacks :foo
+ build_class(->(o) { calls << o }).new.run
assert_equal 10, calls.length
end
def test_symbol
calls = []
klass = build_class(:bar)
klass.class_eval { define_method(:bar) { calls << klass } }
- klass.new.run_callbacks :foo
+ klass.new.run
assert_equal 1, calls.length
end
def test_string
calls = []
klass = build_class("bar")
klass.class_eval { define_method(:bar) { calls << klass } }
- klass.new.run_callbacks :foo
+ klass.new.run
assert_equal 1, calls.length
end
end

0 comments on commit d32b329

Please sign in to comment.