2012-11-28 04:58:52 -05:00
|
|
|
require 'spec_helper'
|
2011-10-16 15:13:25 -04:00
|
|
|
|
|
|
|
describe "the new dsl" do
|
|
|
|
|
2012-11-28 04:58:52 -05:00
|
|
|
let(:process) {ProcessWithNewDsl.new}
|
|
|
|
|
2011-10-16 15:13:25 -04:00
|
|
|
it 'should use an initial event' do
|
2012-11-28 04:58:52 -05:00
|
|
|
process.aasm_current_state.should == :sleeping
|
|
|
|
process.should be_sleeping
|
2011-10-16 15:13:25 -04:00
|
|
|
end
|
2012-11-28 04:58:52 -05:00
|
|
|
|
2011-10-16 15:13:25 -04:00
|
|
|
it 'should have states and transitions' do
|
2012-11-28 04:58:52 -05:00
|
|
|
process.flagged.should be_nil
|
|
|
|
process.start!
|
|
|
|
process.should be_running
|
|
|
|
process.flagged.should be_true
|
|
|
|
process.stop!
|
|
|
|
process.should be_suspended
|
2011-10-16 15:13:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not conflict with other event or state methods' do
|
|
|
|
lambda {ProcessWithNewDsl.state}.should raise_error(RuntimeError, "wrong state method")
|
|
|
|
lambda {ProcessWithNewDsl.event}.should raise_error(RuntimeError, "wrong event method")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|