class MachineWithCustomPluralTest

Attributes

with_scopes[RW]
without_scopes[RW]

Public Instance Methods

create_with_scope(name) click to toggle source
# File test/unit/machine_test.rb, line 854
def create_with_scope(name)
  StateMachine::Integrations::Custom.with_scopes << name
  lambda {}
end
create_without_scope(name) click to toggle source
# File test/unit/machine_test.rb, line 859
def create_without_scope(name)
  StateMachine::Integrations::Custom.without_scopes << name
  lambda {}
end
setup() click to toggle source
# File test/unit/machine_test.rb, line 846
def setup
  @integration = Module.new do
    include StateMachine::Integrations::Base
    
    class << self; attr_accessor :with_scopes, :without_scopes; end
    @with_scopes = []
    @without_scopes = []
    
    def create_with_scope(name)
      StateMachine::Integrations::Custom.with_scopes << name
      lambda {}
    end
    
    def create_without_scope(name)
      StateMachine::Integrations::Custom.without_scopes << name
      lambda {}
    end
  end
  
  StateMachine::Integrations.const_set('Custom', @integration)
  @machine = StateMachine::Machine.new(Class.new, :integration => :custom, :plural => 'staties')
end
teardown() click to toggle source
# File test/unit/machine_test.rb, line 877
def teardown
  StateMachine::Integrations.send(:remove_const, 'Custom')
end
test_should_define_a_singular_and_plural_with_scope() click to toggle source
# File test/unit/machine_test.rb, line 869
def test_should_define_a_singular_and_plural_with_scope
  assert_equal %w(with_state with_staties), @integration.with_scopes
end
test_should_define_a_singular_and_plural_without_scope() click to toggle source
# File test/unit/machine_test.rb, line 873
def test_should_define_a_singular_and_plural_without_scope
  assert_equal %w(without_state without_staties), @integration.without_scopes
end