spec/units/machine_spec.rb in state-fu-0.13.1 vs spec/units/machine_spec.rb in state-fu-0.13.3
- old
+ new
@@ -22,12 +22,12 @@
make_pristine_class 'Klass'
end
it "should create a new machine and bind! it" do
@machine = Object.new
- mock(@machine).bind!(Klass, :moose, {})
- mock(StateFu::Machine).new({}) { @machine }
+ @machine.should_receive(:bind!).with(Klass, :moose, {})
+ StateFu::Machine.should_receive(:new).and_return @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
@@ -71,11 +71,11 @@
end
describe ".bind!" do
it "should call StateFu::Machine.bind! with itself and its arguments" do
field_name = :my_field_name
- mock( StateFu::Machine ).bind!( @m, Klass, :newname, field_name ) {}
+ StateFu::Machine.should_receive(:bind!).with @m, Klass, :newname, field_name
@m.bind!( Klass, :newname, field_name )
end
it "should generate a field name if none is given" do
klass = Klass
@@ -117,10 +117,10 @@
@m.states.should == []
@m.initial_state.should == nil
end
it "should return the first state if one exists" do
- stub( @m ).states() { [:a, :b, :c] }
+ @m.should_receive(:states).and_return [:a, :b, :c]
@m.initial_state.should == :a
end
end