Sha256: 2adb9cc0fdae5db78037cc4f0d6b386a2afaaad242718ebfdf097075ffeba79c
Contents?: true
Size: 703 Bytes
Versions: 2
Compression:
Stored size: 703 Bytes
Contents
require 'helper' class ChecksTestSubject include Transitions state_machine initial: :initial do state :initial state :opened state :closed event :open do transitions from: :initial, to: :opened end event :close do transitions from: :opened, to: :closed end end end class StateMachineChecksTest < Test::Unit::TestCase test 'checks if a given transition is possible' do subject = ChecksTestSubject.new assert_equal :initial, subject.current_state assert_equal true, subject.can_open? assert_equal false, subject.can_close? subject.open assert_equal false, subject.can_open? assert_equal true, subject.can_close? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transitions-1.0.0 | test/event/test_event_checks.rb |
transitions-0.2.1 | test/event/test_event_checks.rb |