class DataMapperTest::MachineWithScopesTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1788 def setup @resource = new_resource @machine = StateMachine::Machine.new(@resource) @machine.state :parked, :first_gear @machine.state :idling, :value => lambda {'idling'} end
test_should_allow_chaining_scopes()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1847 def test_should_allow_chaining_scopes parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' assert_equal [idling], @resource.without_state(:parked).with_state(:idling) end
test_should_allow_lookup_by_string_name()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1817 def test_should_allow_lookup_by_string_name parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' assert_equal [parked, idling], @resource.with_states('parked', 'idling') end
test_should_create_plural_with_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1806 def test_should_create_plural_with_scope assert @resource.respond_to?(:with_states) end
test_should_create_plural_without_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1835 def test_should_create_plural_without_scope assert @resource.respond_to?(:without_states) end
test_should_create_singular_with_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1795 def test_should_create_singular_with_scope assert @resource.respond_to?(:with_state) end
test_should_create_singular_without_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1824 def test_should_create_singular_without_scope assert @resource.respond_to?(:without_state) end
test_should_only_include_records_with_state_in_singular_with_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1799 def test_should_only_include_records_with_state_in_singular_with_scope parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' assert_equal [parked], @resource.with_state(:parked) end
test_should_only_include_records_with_states_in_plural_with_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1810 def test_should_only_include_records_with_states_in_plural_with_scope parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' assert_equal [parked, idling], @resource.with_states(:parked, :idling) end
test_should_only_include_records_without_state_in_singular_without_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1828 def test_should_only_include_records_without_state_in_singular_without_scope parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' assert_equal [parked], @resource.without_state(:idling) end
test_should_only_include_records_without_states_in_plural_without_scope()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1839 def test_should_only_include_records_without_states_in_plural_without_scope parked = @resource.create :state => 'parked' idling = @resource.create :state => 'idling' first_gear = @resource.create :state => 'first_gear' assert_equal [parked, idling], @resource.without_states(:first_gear) end