ruby on rails - how do you stub/expect a state_machine event? -
i want this:
@vehicle.should_receive(:park) @vehicle.stub!(:park) vehicle.any_instance.stub(:park) # etc. so can validate interaction or use state_machine in other specs without overhead of changing states...
how accomplish this?
use of above methods wrote about. note, think in versions of rspec, stubbing directly, or #should_receive replace body of said stubbed method. if later test side effects, won't present.
usually work around with.
@vehicle.should_receive(:park) @vehicle.state = :parked end expect @person.exit_vehicle end.should change(@vehicle.state).from(:driving).to(:parked)
Comments
Post a Comment