-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "helper" | ||
|
||
class Bender | ||
include Transitions | ||
|
||
state_machine :default do | ||
state :drinking | ||
state :smoking | ||
state :gambling | ||
end | ||
|
||
state_machine :maintenance do | ||
state :wip | ||
state :finished | ||
end | ||
end | ||
|
||
class TestAvailableStatesListing < Test::Unit::TestCase | ||
test 'available_states should return the states for the default state machine if no state machine is specified' do | ||
assert_equal [:drinking, :gambling, :smoking], Bender.available_states | ||
end | ||
|
||
test 'available_states should return the states for a given state' do | ||
assert_equal [:finished, :wip], Bender.available_states(:maintenance) | ||
assert_equal [:drinking, :gambling, :smoking], Bender.available_states(:default) | ||
end | ||
end |