class CallbackWithApplicationBoundObjectTest

Public Instance Methods

setup() click to toggle source
# File test/unit/callback_test.rb, line 438
def setup
  @original_bind_to_object = StateMachine::Callback.bind_to_object
  StateMachine::Callback.bind_to_object = true
  
  context = nil
  @callback = StateMachine::Callback.new(:before, :do => lambda {|*args| context = self})
  
  @object = Object.new
  @callback.call(@object)
  @context = context
end
teardown() click to toggle source
# File test/unit/callback_test.rb, line 454
def teardown
  StateMachine::Callback.bind_to_object = @original_bind_to_object
end
test_should_call_method_within_the_context_of_the_object() click to toggle source
# File test/unit/callback_test.rb, line 450
def test_should_call_method_within_the_context_of_the_object
  assert_equal @object, @context
end