Sha256: 58614c22658454face0fa98eb4888b61b803118ca0fc3220eb4eb76461ba5861
Contents?: true
Size: 889 Bytes
Versions: 1
Compression:
Stored size: 889 Bytes
Contents
require_relative 'test_helper' class MachineWithNonColumnStateAttributeDefinedTest < BaseTestCase def setup @model = new_model do def status=(value) self['status'] = value end def status self['status'] end end @machine = StateMachines::Machine.new(@model, :status, :initial => :parked) @machine.other_states(:idling) @record = @model.new end def test_should_return_false_for_predicate_if_does_not_match_current_value refute @record.status?(:idling) end def test_should_return_true_for_predicate_if_matches_current_value assert @record.status?(:parked) end def test_should_raise_exception_for_predicate_if_invalid_state_specified assert_raise(IndexError) { @record.status?(:invalid) } end def test_should_set_initial_state_on_created_object assert_equal 'parked', @record.status end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
state_machines-activerecord-0.0.1 | test/machine_with_non_column_state_attribute_defined_test.rb |