class StateWithConflictingHelpersBeforeDefinitionTest

Public Instance Methods

parked?() click to toggle source
# File test/unit/state_test.rb, line 467
def parked?
  0
end
setup() click to toggle source
# File test/unit/state_test.rb, line 462
def setup
  require 'stringio'
  @original_stderr, $stderr = $stderr, StringIO.new
  
  @superclass = Class.new do
    def parked?
      0
    end
  end
  @klass = Class.new(@superclass)
  @machine = StateMachine::Machine.new(@klass)
  @machine.state :parked
  @object = @klass.new
end
teardown() click to toggle source
# File test/unit/state_test.rb, line 485
def teardown
  $stderr = @original_stderr
end
test_should_not_override_state_predicate() click to toggle source
# File test/unit/state_test.rb, line 477
def test_should_not_override_state_predicate
  assert_equal 0, @object.parked?
end
test_should_output_warning() click to toggle source
# File test/unit/state_test.rb, line 481
def test_should_output_warning
  assert_equal "Instance method \"parked?\" is already defined in #{@superclass.to_s}, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.\n", $stderr.string
end