Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enhance settings test state_machine #15

  • Loading branch information...
commit 667c3d78529ebc3b34376bba065dad2fef13e60b 1 parent a58d3a0
Gleb Pomykalov authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 spec/settings/callbacks_spec.rb
View
14 spec/settings/callbacks_spec.rb
@@ -67,20 +67,20 @@ def prepare(starter, &block)
@engine_state = states('engine_state').starts_as('pending')
end
- it "should work in correct order" do
+ it "should work in correct order with many callbacks" do
@before_prepare = mock('before_prepare')
- @before_prepare.expects('touch').when(@engine_state.is('pending')).once.then(@engine_state.is('before_prepare_invoked'))
+ @before_prepare.expects('touch').when(@engine_state.is('pending')).twice
@after_prepare = mock('after_prepare')
- @after_prepare.expects('touch').when(@engine_state.is('prepare_invoked')).once.then(@engine_state.is('after_prepare_invoked'))
+ @after_prepare.expects('touch').when(@engine_state.is('prepare_invoked')).twice
@before_start = mock('before_start')
- @before_start.expects('touch').when(@engine_state.is('after_prepare_invoked')).once.then(@engine_state.is('before_start_invoked'))
+ @before_start.expects('touch').when(@engine_state.is('after_prepare_invoked')).twice
@callbacks = {
- :before_prepare => [ Proc.new { @before_prepare.touch } ],
- :after_prepare => [ Proc.new { @after_prepare.touch } ],
- :before_start => [ Proc.new { @before_start.touch } ]
+ :before_prepare => [ Proc.new { @before_prepare.touch }, Proc.new { @before_prepare.touch; @engine_state.become('before_prepare_invoked') } ],
+ :after_prepare => [ Proc.new { @after_prepare.touch }, Proc.new { @after_prepare.touch; @engine_state.become('after_prepare_invoked') } ],
+ :before_start => [ Proc.new { @before_start.touch }, Proc.new { @before_start.touch; @engine_state.become('before_start_invoked') } ]
}
@engine = Daemonizer::Engine.new(Daemonizer::Config.new(:pool, {
Please sign in to comment.
Something went wrong with that request. Please try again.