class EventWithConflictingHelpersBeforeDefinitionTest

Public Instance Methods

can_ignite?() click to toggle source
# File test/unit/event_test.rb, line 136
def can_ignite?
  0
end
ignite() click to toggle source
# File test/unit/event_test.rb, line 144
def ignite
  0
end
ignite!() click to toggle source
# File test/unit/event_test.rb, line 148
def ignite!
  0
end
ignite_transition() click to toggle source
# File test/unit/event_test.rb, line 140
def ignite_transition
  0
end
setup() click to toggle source
# File test/unit/event_test.rb, line 131
def setup
  require 'stringio'
  @original_stderr, $stderr = $stderr, StringIO.new
  
  @superclass = Class.new do
    def can_ignite?
      0
    end
    
    def ignite_transition
      0
    end
    
    def ignite
      0
    end
    
    def ignite!
      0
    end
  end
  @klass = Class.new(@superclass)
  @machine = StateMachine::Machine.new(@klass)
  @machine.events << @event = StateMachine::Event.new(@machine, :ignite)
  @object = @klass.new
end
teardown() click to toggle source
# File test/unit/event_test.rb, line 182
def teardown
  $stderr = @original_stderr
end
test_should_not_redefine_action() click to toggle source
# File test/unit/event_test.rb, line 166
def test_should_not_redefine_action
  assert_equal 0, @object.ignite
end
test_should_not_redefine_bang_action() click to toggle source
# File test/unit/event_test.rb, line 170
def test_should_not_redefine_bang_action
  assert_equal 0, @object.ignite!
end
test_should_not_redefine_predicate() click to toggle source
# File test/unit/event_test.rb, line 158
def test_should_not_redefine_predicate
  assert_equal 0, @object.can_ignite?
end
test_should_not_redefine_transition_accessor() click to toggle source
# File test/unit/event_test.rb, line 162
def test_should_not_redefine_transition_accessor
  assert_equal 0, @object.ignite_transition
end
test_should_output_warning() click to toggle source
# File test/unit/event_test.rb, line 174
def test_should_output_warning
  expected = %w(can_ignite? ignite_transition ignite ignite!).map do |method|
    "Instance method \"#{method}\" is already defined in #{@superclass.to_s}, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.\n"
  end.join
  
  assert_equal expected, $stderr.string
end