From 29304c70ae8a3d571b85f827935a63332cc2cb13 Mon Sep 17 00:00:00 2001 From: Scott Barron Date: Sun, 2 Mar 2008 07:33:37 -0500 Subject: [PATCH] Some specs for #aasm_events_for_current_state --- TODO | 1 - spec/unit/aasm_spec.rb | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 98231fe..a2de8f7 100644 --- a/TODO +++ b/TODO @@ -9,6 +9,5 @@ Cool ideas from users: * Support multiple state machines on one object (Chris Nelson) * http://justbarebones.blogspot.com/2007/11/actsasstatemachine-enhancements.html (Chetan Patil) -* next_events_for_current_state (Nick Plante) * transition logging (Artem Vasiliev) * timestamp column for state change on AR (Mike Ferrier) diff --git a/spec/unit/aasm_spec.rb b/spec/unit/aasm_spec.rb index 7498b7a..93bd1be 100644 --- a/spec/unit/aasm_spec.rb +++ b/spec/unit/aasm_spec.rb @@ -107,3 +107,18 @@ describe AASM, '- persistence' do foo.aasm_current_state end end + +describe AASM, '- getting events for a state' do + it '#aasm_events_for_current_state should use current state' do + foo = Foo.new + foo.should_receive(:aasm_current_state) + foo.aasm_events_for_current_state + end + + it '#aasm_events_for_current_state should use aasm_events_for_state' do + foo = Foo.new + foo.stub!(:aasm_current_state).and_return(:foo) + foo.should_receive(:aasm_events_for_state).with(:foo) + foo.aasm_events_for_current_state + end +end