diff --git a/lib/workflow.rb b/lib/workflow.rb index 7901fd2..c5defcc 100644 --- a/lib/workflow.rb +++ b/lib/workflow.rb @@ -286,7 +286,7 @@ def run_action(action, *args) end def has_callback?(action) - self.respond_to?(action) or self.class.private_method_defined?(action) + self.respond_to?(action) or self.private_methods(false).map(&:to_sym).include?(action) end def run_action_callback(action_name, *args) diff --git a/test/main_test.rb b/test/main_test.rb index f65edd7..93736f3 100644 --- a/test/main_test.rb +++ b/test/main_test.rb @@ -311,6 +311,22 @@ def assign(args) a.assign!(args) end + test '#58 Limited private transition callback lookup' do + args = mock() + c = Class.new + c.class_eval do + include Workflow + workflow do + state :new do + event :fail, :transitions_to => :failed + end + state :failed + end + end + a = c.new + a.fail!(args) + end + test 'Single table inheritance (STI)' do class BigOrder < Order end