class MachineWithSuperclassConflictingHelpersAfterDefinitionTest

Public Instance Methods

setup() click to toggle source
# File test/unit/machine_test.rb, line 1836
def setup
  require 'stringio'
  @original_stderr, $stderr = $stderr, StringIO.new
  
  @superclass = Class.new
  @klass = Class.new(@superclass)
  
  @machine = StateMachine::Machine.new(@klass)
  @machine.state :parked, :idling
  @machine.event :ignite
  
  @superclass.class_eval do
    def state?
      true
    end
  end
  
  @object = @klass.new
end
state?() click to toggle source
# File test/unit/machine_test.rb, line 1848
def state?
  true
end
teardown() click to toggle source
# File test/unit/machine_test.rb, line 1864
def teardown
  $stderr = @original_stderr
end
test_should_call_superclass_attribute_predicate_without_arguments() click to toggle source
# File test/unit/machine_test.rb, line 1856
def test_should_call_superclass_attribute_predicate_without_arguments
  assert @object.state?
end
test_should_define_attribute_predicate_with_arguments() click to toggle source
# File test/unit/machine_test.rb, line 1860
def test_should_define_attribute_predicate_with_arguments
  assert !@object.state?(:parked)
end