Sha256: edd1793f113530eec729ca9861f7296d4dc01b449ed130a3ef06ebc29ae98b4a
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require 'spec_helper' class MachineTestSubject include EdgeStateMachine state_machine do state :open state :closed end state_machine :initial => :foo do event :shutdown do transitions :from => :open, :to => :closed end event :timeout do transitions :from => :open, :to => :closed end end state_machine :extra, :initial => :bar do end end describe EdgeStateMachine::Machine do it 'should allow reuse of existing machines' do MachineTestSubject.state_machines.size.should == 2 end it "should set #initial_state from :initial option" do MachineTestSubject.state_machine(:extra).initial_state.should == :bar end it "should accesse non-default state machine" do MachineTestSubject.state_machine(:extra).class.should == EdgeStateMachine::Machine end it "should find event for given state" do events = MachineTestSubject.state_machine.events_for(:open) events.should be_include(:shutdown) events.should be_include(:timeout) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
edge-state-machine-0.0.2 | spec/machine_spec.rb |
edge-state-machine-0.0.1 | spec/machine_spec.rb |