Sha256: 94f49fca71f4f04586fb495ac0f0465b8efedd568290a9b6baecf985a2f350df
Contents?: true
Size: 1.3 KB
Versions: 5
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe Restfulie::Client::Mikyung::SteadyStateWalker do before do @goal = Object.new @current = Object.new @mikyung = Object.new @walker = Restfulie::Client::Mikyung::SteadyStateWalker.new end it "should throw an error if there is no step to follow" do @goal.should_receive(:next_step).with(@current, @mikyung) lambda {@walker.move(@goal, @current, @mikyung)}.should raise_error Restfulie::Client::UnableToAchieveGoalError end it "should try to execute the step three times if it is an instantiated object" do next_step = Object.new @goal.should_receive(:next_step).with(@current, @mikyung).and_return(next_step) @walker.should_receive(:try_to_execute).with(next_step, @current, 3, @mikyung).and_return(next_step) @walker.move(@goal, @current, @mikyung).should == next_step end class CustomStep end it "should instantiate the step prior to executing it" do step = CustomStep @goal.should_receive(:next_step).with(@current, @mikyung).and_return(step) next_step = CustomStep.new CustomStep.should_receive(:new).and_return(next_step) @walker.should_receive(:try_to_execute).with(next_step, @current, 3, @mikyung).and_return(next_step) @walker.move(@goal, @current, @mikyung).should == next_step end end
Version data entries
5 entries across 5 versions & 2 rubygems