Sha256: 42a95df4155908f4a762ce6a9ca7eabc8531daa7d7a3c5309a575e6808896f90
Contents?: true
Size: 831 Bytes
Versions: 9
Compression:
Stored size: 831 Bytes
Contents
require 'spec_helper' describe 'testing the README examples' do it 'Usage' do class Job include AASM aasm do state :sleeping, :initial => true state :running state :cleaning event :run do transitions :from => :sleeping, :to => :running end event :clean do transitions :from => :running, :to => :cleaning end event :sleep do transitions :from => [:running, :cleaning], :to => :sleeping end end end job = Job.new expect(job.sleeping?).to eql true expect(job.may_run?).to eql true job.run expect(job.running?).to eql true expect(job.sleeping?).to eql false expect(job.may_run?).to eql false expect { job.run }.to raise_error(AASM::InvalidTransition) end end
Version data entries
9 entries across 9 versions & 1 rubygems