class StateWithExistingContextMethodTest

Public Instance Methods

setup() click to toggle source
# File test/unit/state_test.rb, line 710
def setup
  @klass = Class.new do
    def speed
      60
    end
  end
  @original_speed_method = @klass.instance_method(:speed)
  
  @machine = StateMachine::Machine.new(@klass)
  @machine.states << @state = StateMachine::State.new(@machine, :idling)
  @state.context do
    def speed
      0
    end
  end
end
speed() click to toggle source
# File test/unit/state_test.rb, line 712
def speed
  60
end
test_should_not_override_method() click to toggle source
# File test/unit/state_test.rb, line 727
def test_should_not_override_method
  assert_equal @original_speed_method, @klass.instance_method(:speed)
end