mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
made sure, old state callbacks are still working with the new dsl
This commit is contained in:
parent
b22ceb2792
commit
0a961c122f
2 changed files with 9 additions and 1 deletions
|
@ -5,9 +5,11 @@ class ProcessWithNewDsl
|
|||
raise "wrong state method"
|
||||
end
|
||||
|
||||
attr_accessor :flagged
|
||||
|
||||
aasm do
|
||||
state :sleeping, :initial => true
|
||||
state :running
|
||||
state :running, :after_enter => :flag
|
||||
state :suspended
|
||||
|
||||
event :start do
|
||||
|
@ -18,6 +20,10 @@ class ProcessWithNewDsl
|
|||
end
|
||||
end
|
||||
|
||||
def flag
|
||||
self.flagged = true
|
||||
end
|
||||
|
||||
def self.event(*args)
|
||||
raise "wrong event method"
|
||||
end
|
||||
|
|
|
@ -12,8 +12,10 @@ describe "the new dsl" do
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue