Sha256: 653de35488c15617db1274570b27313320eb89dc59799cc18dc5b90f8b2f448a
Contents?: true
Size: 719 Bytes
Versions: 14
Compression:
Stored size: 719 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
14 entries across 14 versions & 1 rubygems