class SequelTest::MachineWithColumnStateAttributeTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 337 def setup @model = new_model @machine = StateMachine::Machine.new(@model, :initial => :parked) @machine.other_states(:idling) @record = @model.new end
test_should_have_an_attribute_predicate()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 357 def test_should_have_an_attribute_predicate assert @record.respond_to?(:state?) end
test_should_not_override_the_column_reader()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 345 def test_should_not_override_the_column_reader record = @model.new record[:state] = 'parked' assert_equal 'parked', record.state end
test_should_not_override_the_column_writer()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 351 def test_should_not_override_the_column_writer record = @model.new record.state = 'parked' assert_equal 'parked', record[:state] end
test_should_raise_exception_for_predicate_if_invalid_state_specified()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 374 def test_should_raise_exception_for_predicate_if_invalid_state_specified assert_raise(IndexError) { @record.state?(:invalid) } end
test_should_raise_exception_for_predicate_without_parameters()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 361 def test_should_raise_exception_for_predicate_without_parameters exception = assert_raise(ArgumentError) { @record.state? } assert_equal 'wrong number of arguments (1 for 2)', exception.message end
test_should_return_false_for_predicate_if_does_not_match_current_value()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 366 def test_should_return_false_for_predicate_if_does_not_match_current_value assert !@record.state?(:idling) end
test_should_return_true_for_predicate_if_matches_current_value()
click to toggle source
# File test/unit/integrations/sequel_test.rb, line 370 def test_should_return_true_for_predicate_if_matches_current_value assert @record.state?(:parked) end