class CallbackWithMixedMethodsTest

Public Instance Methods

setup() click to toggle source
# File test/unit/callback_test.rb, line 189
def setup
  @callback = StateMachine::Callback.new(:before, :run_argument, :do => :run_do) do |object|
    object.callbacks << :block
  end
  
  class << @object = Object.new
    attr_accessor :callbacks
    
    def run_argument
      (@callbacks ||= []) << :argument
    end
    
    def run_do
      (@callbacks ||= []) << :do
    end
  end
  
  @result = @callback.call(@object)
end
test_should_be_successful() click to toggle source
# File test/unit/callback_test.rb, line 209
def test_should_be_successful
  assert @result
end
test_should_call_each_callback_in_order() click to toggle source
# File test/unit/callback_test.rb, line 213
def test_should_call_each_callback_in_order
  assert_equal [:argument, :do, :block], @object.callbacks
end