Skip to content

Commit

Permalink
made sure, old state callbacks are still working with the new dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
alto committed Nov 25, 2011
1 parent b22ceb2 commit 0a961c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/models/process_with_new_dsl.rb
Expand Up @@ -5,9 +5,11 @@ def self.state(*args)
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
Expand All @@ -18,6 +20,10 @@ def self.state(*args)
end
end

def flag
self.flagged = true
end

def self.event(*args)
raise "wrong event method"
end
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/new_dsl_spec.rb
Expand Up @@ -12,8 +12,10 @@
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
Expand Down

0 comments on commit 0a961c1

Please sign in to comment.