Sha256: 1e56542f9da8fa8b7789074b84d8f4a99900e8b452d2dce1349a073ad971937c
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require 'non_persistent/non_persistent_helper' describe Dice do before do @dice = Dice.new end it "should have a current state equals with the initial state" do @dice.current_state_name.should == :one end it "should have an event trigger method" do @dice.should respond_to :roll end it "should change state after the event method is called" do @dice.roll @dice.current_state_name.should_not == :one end end describe User do before do @user = User.new end it "should have a current state equals with the initial state" do @user.current_state_name.should == :pending end it "should have an event trigger method" do @user.should respond_to :activate end it "should have state verfification methods for each state" do @user.pending?.should == true @user.active?.should_not == true @user.blocked?.should_not == true end it "should change state after the event method is called" do @user.activate @user.current_state_name.should == :active end end describe Microwave do before do @microwave = Microwave.new end it "should have a current state equals with the initial state" do @microwave.current_state_name(:microwave).should == :unplugged end it "should have an event trigger method" do @microwave.should respond_to :plug_in end it "should have state verfification methods for each state" do @microwave.unplugged?.should == true @microwave.plugged?.should_not == true @microwave.door_opened?.should_not == true @microwave.door_closed?.should_not == true @microwave.started_in_grill_mode?.should_not == true @microwave.started?.should_not == true end it "should change state after the event method is called" do @microwave.plug_in @microwave.current_state_name(:microwave).should == :plugged @microwave.plugged?.should == true end it "should execute enter state action" do @microwave.plug_in end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
edge-state-machine-0.0.3 | spec/non_persistent/non_persistent_spec.rb |