2011-10-16 15:13:25 -04:00
|
|
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
|
|
|
|
|
|
describe "the new dsl" do
|
|
|
|
|
|
|
|
before(:each) do
|
|
|
|
@process = ProcessWithNewDsl.new
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should use an initial event' do
|
|
|
|
@process.aasm_current_state.should == :sleeping
|
|
|
|
@process.should be_sleeping
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should have states and transitions' do
|
2011-11-25 17:55:56 -05:00
|
|
|
@process.flagged.should be_nil
|
2011-10-16 15:13:25 -04:00
|
|
|
@process.start!
|
|
|
|
@process.should be_running
|
2011-11-25 17:55:56 -05:00
|
|
|
@process.flagged.should be_true
|
2011-10-16 15:13:25 -04:00
|
|
|
@process.stop!
|
|
|
|
@process.should be_suspended
|
|
|
|
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
|