1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/unit/new_dsl_spec.rb

28 lines
790 B
Ruby

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
@process.flagged.should be_nil
@process.start!
@process.should be_running
@process.flagged.should be_true
@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