Sha256: 7ef2ce5d64bd14f6f87c9f525277e4220074462cc45d9e8557178d8c4a226130
Contents?: true
Size: 800 Bytes
Versions: 15
Compression:
Stored size: 800 Bytes
Contents
require_relative 'test_helper' class MachineWithNonColumnStateAttributeDefinedTest < BaseTestCase def setup @model = new_model do attr_accessor :status 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
15 entries across 15 versions & 2 rubygems