spec/units/machine_spec.rb in davidlee-state-fu-0.11.1 vs spec/units/machine_spec.rb in davidlee-state-fu-0.12.0

- old
+ new

@@ -18,26 +18,23 @@ describe "Machine.for_class" do describe "when there's no machine defined for the class" do before do reset! make_pristine_class 'Klass' - # mock( Klass ).machines() { {} } end it "should create a new machine and bind! it" do @machine = Object.new - mock( @machine ).bind!( Klass, :moose, nil ) - mock( StateFu::Machine ).new( {} ) { @machine } - StateFu::Machine.for_class( Klass, :moose ) + mock(@machine).bind!(Klass, :moose, {}) + mock(StateFu::Machine).new({}) { @machine } + StateFu::Machine.for_class Klass, :moose end it "should apply the block (via lathe) if one is given" do - @m = StateFu::Machine.for_class( Klass, :snoo ) do + @m = StateFu::Machine.for_class Klass, :snoo do state :porpoise end -# mock( Klass ).machines() { {} } - # @m.states.map(&:name).should == [:porpoise] end end end end @@ -83,10 +80,10 @@ it "should generate a field name if none is given" do klass = Klass name = :StinkJuice field_name = 'stink_juice_field' @m.bind!( Klass, name ) - Klass.state_fu_field_names[name].should == 'stink_juice_field' + Klass.state_fu_options[name][:field_name].should == 'stink_juice_field' end end describe ".initial_state=" do