class MachineWithCustomIntegrationTest

Public Class Methods

available?() click to toggle source
# File test/unit/machine_test.rb, line 502
def self.available?
  true
end
matches?(klass) click to toggle source
# File test/unit/machine_test.rb, line 506
def self.matches?(klass)
  true
end

Public Instance Methods

setup() click to toggle source
# File test/unit/machine_test.rb, line 498
def setup
  integration = Module.new do
    include StateMachine::Integrations::Base
    
    def self.available?
      true
    end
    
    def self.matches?(klass)
      true
    end
  end
  
  StateMachine::Integrations.const_set('Custom', integration)
end
teardown() click to toggle source
# File test/unit/machine_test.rb, line 556
def teardown
  StateMachine::Integrations.send(:remove_const, 'Custom')
end
test_should_be_extended_by_the_integration_if_explicit() click to toggle source
# File test/unit/machine_test.rb, line 514
def test_should_be_extended_by_the_integration_if_explicit
  machine = StateMachine::Machine.new(Class.new, :integration => :custom)
  assert (class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end
test_should_be_extended_by_the_integration_if_implicit_and_available_and_matches() click to toggle source
# File test/unit/machine_test.rb, line 541
def test_should_be_extended_by_the_integration_if_implicit_and_available_and_matches
  machine = StateMachine::Machine.new(Class.new)
  assert (class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end
test_should_not_be_extended_by_the_integration_if_false() click to toggle source
# File test/unit/machine_test.rb, line 551
def test_should_not_be_extended_by_the_integration_if_false
  machine = StateMachine::Machine.new(Class.new, :integration => false)
  assert !(class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end
test_should_not_be_extended_by_the_integration_if_implicit_but_not_available() click to toggle source
# File test/unit/machine_test.rb, line 519
def test_should_not_be_extended_by_the_integration_if_implicit_but_not_available
  StateMachine::Integrations::Custom.class_eval do
    def self.available?
      false
    end
  end
  
  machine = StateMachine::Machine.new(Class.new)
  assert !(class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end
test_should_not_be_extended_by_the_integration_if_implicit_but_not_matched() click to toggle source
# File test/unit/machine_test.rb, line 530
def test_should_not_be_extended_by_the_integration_if_implicit_but_not_matched
  StateMachine::Integrations::Custom.class_eval do
    def self.matches?(klass)
      false
    end
  end
  
  machine = StateMachine::Machine.new(Class.new)
  assert !(class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end
test_should_not_be_extended_by_the_integration_if_nil() click to toggle source
# File test/unit/machine_test.rb, line 546
def test_should_not_be_extended_by_the_integration_if_nil
  machine = StateMachine::Machine.new(Class.new, :integration => nil)
  assert !(class << machine; ancestors; end).include?(StateMachine::Integrations::Custom)
end