Further set up for functional tests

This commit is contained in:
Scott Barron 2008-02-21 12:32:04 -05:00
parent 7a734376c4
commit 8fc83db605
3 changed files with 50 additions and 2 deletions

View File

@ -1,4 +1,5 @@
require File.join(File.dirname(__FILE__), 'event')
require File.join(File.dirname(__FILE__), 'state')
module AASM
class InvalidTransition < Exception

View File

@ -0,0 +1,48 @@
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'aasm')
class Conversation
include AASM
initial_state :needs_attention
state :needs_attention
state :read
state :closed
state :awaiting_response
state :junk
event :new_message do
end
event :view do
transitions :to => :read, :from => [:needs_attention]
end
event :reply do
end
event :close do
transitions :to => :closed, :from => [:read, :awaiting_response]
end
event :junk do
transitions :to => :junk, :from => [:read]
end
event :unjunk do
end
def initialize(persister)
@persister = persister
end
private
def aasm_read_state
@persister.read_state
end
def aasm_write_state(state)
@persister.write_state(state)
end
end

View File

@ -1,2 +1 @@
require File.join(File.dirname(__FILE__), '..', 'lib', 'aasm')
require File.join(File.dirname(__FILE__), '..', 'lib', 'state')
require File.join(File.dirname(__FILE__), '..', 'aasm')