Sha256: 77abbcb9e23440c9480413fecf985c4f519b260671ffb43f021d654d51d0caa7
Contents?: true
Size: 1019 Bytes
Versions: 5
Compression:
Stored size: 1019 Bytes
Contents
# Hooks on state entrance / exit. Needs more attention. require 'lib/maintain' describe Maintain, "hooks" do before :each do class MaintainTest extend Maintain end end it "should allow me to hook into entry and exit" do lambda { MaintainTest.maintain :state do state :new, :enter => :new_entered state :old, :enter => :old_entered on :enter, :new, :new_entered on :exit, :old do self.old_entered end end }.should_not raise_error end it "should execute hooks when states are entered and exited" do MaintainTest.maintain :state do state :new state :old on :enter, :new, :new_entered on :exit, :old do self.old_entered end end maintain = MaintainTest.new maintain.should_receive(:new_entered) maintain.state = :new maintain.should_receive(:old_entered) maintain.state = :old maintain.should_not_receive(:old_entered) maintain.state = :old end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
maintain-0.1.6 | spec/hooks_spec.rb |
maintain-0.1.5 | spec/hooks_spec.rb |
maintain-0.1.4 | spec/hooks_spec.rb |
maintain-0.1.3 | spec/hooks_spec.rb |
maintain-0.1.2 | spec/hooks_spec.rb |