From 2ac052e8fa7aedb30f86157d6854e91bd80058e7 Mon Sep 17 00:00:00 2001 From: Vladimir Meremyanin Date: Wed, 6 Mar 2013 21:06:49 +0400 Subject: [PATCH] fixed auth_machine, used different syntaxes to do same thing --- spec/models/auth_machine.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/models/auth_machine.rb b/spec/models/auth_machine.rb index 8bd3652..6298511 100644 --- a/spec/models/auth_machine.rb +++ b/spec/models/auth_machine.rb @@ -12,7 +12,11 @@ class AuthMachine state :waiting event :register do - transitions :from => :passive, :to => :pending, :guard => Proc.new {|u| u.can_register? } + transitions :from => :passive, :to => :pending do + guard do + can_register? + end + end end event :activate do @@ -33,8 +37,8 @@ class AuthMachine end event :unsuspend do - transitions :from => :suspended, :to => :active, :guard => Proc.new {|u| u.has_activated? } - transitions :from => :suspended, :to => :pending, :guard => Proc.new {|u| u.has_activation_code? } + transitions :from => :suspended, :to => :active, :guard => Proc.new { has_activated? } + transitions :from => :suspended, :to => :pending, :guard => :has_activation_code? transitions :from => :suspended, :to => :passive end