提交 e8e7d835 编写于 作者: A Aaron Patterson

Merge branch 'polymorphic'

* polymorphic: (41 commits)
  fix shadowed variable warnings
  polymorphic around callbacks
  polymorphic after filter
  rename terminal to halting, try to keep naming consistent
  push the before filter lambdas to factory methods
  polymorphic before callbacks
  use a singleton end node
  Revert "we never pass blocks, so remove this"
  if there is nothing to compile, then do not bother compiling
  Arrays are no longer supported
  we never pass blocks, so remove this
  raise an argument error if the filter arity is greater than 1
  pass the actual filter, not a string
  do not keep a reference to the chain in the callback objects
  fix deprecation test
  push merge code to the callback itself
  dup the callback and set the chain
  remove klass because it is not used
  rename instance variables
  push duplicates? logic to the instance
  ...
......@@ -166,7 +166,7 @@ def test_validate_block_with_params
def test_invalid_validator
Topic.validate :i_dont_exist
assert_raise(NameError) do
assert_raises(NoMethodError) do
t = Topic.new
t.valid?
end
......
......@@ -43,7 +43,7 @@ def history
end
class CallbackDeveloperWithFalseValidation < CallbackDeveloper
before_validation proc { |model| model.history << [:before_validation, :returning_false]; return false }
before_validation proc { |model| model.history << [:before_validation, :returning_false]; false }
before_validation proc { |model| model.history << [:before_validation, :should_never_get_here] }
end
......
......@@ -718,7 +718,7 @@ def test_termination
def test_termination_invokes_hook
terminator = CallbackTerminator.new
terminator.save
assert_equal ":second", terminator.halted
assert_equal :second, terminator.halted
end
def test_block_never_called_if_terminated
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册