From 0a961c122f29ed5aa9c0a8e44f2fbfb54586a43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Bo=CC=88ttger?= Date: Fri, 25 Nov 2011 23:55:56 +0100 Subject: [PATCH] made sure, old state callbacks are still working with the new dsl --- spec/models/process_with_new_dsl.rb | 8 +++++++- spec/unit/new_dsl_spec.rb | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/models/process_with_new_dsl.rb b/spec/models/process_with_new_dsl.rb index e4455e7..d45cb6c 100644 --- a/spec/models/process_with_new_dsl.rb +++ b/spec/models/process_with_new_dsl.rb @@ -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 diff --git a/spec/unit/new_dsl_spec.rb b/spec/unit/new_dsl_spec.rb index d8231a5..dce4ecc 100644 --- a/spec/unit/new_dsl_spec.rb +++ b/spec/unit/new_dsl_spec.rb @@ -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