1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/models/parametrised_event.rb
Thorsten Böttger f34d152bc9 Merge branch 'transition_success_callbacks' of https://github.com/brega/aasm into brega-transition_success_callbacks
Conflicts:
	lib/aasm/core/transition.rb
	spec/models/callbacks/basic.rb
	spec/unit/transition_spec.rb
2016-03-19 17:42:35 +13:00

35 lines
888 B
Ruby

class ParametrisedEvent
include AASM
aasm do
state :sleeping, :initial => true
state :showering
state :working
state :dating
state :prettying_up
event :wakeup do
transitions :from => :sleeping, :to => [:showering, :working]
end
event :dress do
transitions :from => :sleeping, :to => :working, :after => :wear_clothes, :success => :wear_makeup
transitions :from => :showering, :to => [:working, :dating], :after => Proc.new { |*args| wear_clothes(*args) }, :success => proc { |*args| wear_makeup(*args) }
transitions :from => :showering, :to => :prettying_up, :after => [:condition_hair, :fix_hair], :success => [:touch_up_hair]
end
end
def wear_clothes(shirt_color, trouser_type=nil)
end
def wear_makeup(makeup, moisturizer)
end
def condition_hair
end
def fix_hair
end
def touch_up_hair
end
end