Sha256: 89e42689d05652d07aa4d043f397af18947bca69bdfdbc2331b75a69e1e3d823
Contents?: true
Size: 1.6 KB
Versions: 14
Compression:
Stored size: 1.6 KB
Contents
#encoding: utf-8 require File.join(File.dirname(__FILE__), "../../spec_helper") include Nudge describe CodeCdrInstruction do it_should_behave_like "every Nudge Instruction" before(:each) do @context = Interpreter.new @i1 = CodeCdrInstruction.new(@context) end describe "\#go" do before(:each) do @context = Interpreter.new @i1 = CodeCdrInstruction.new(@context) end describe "\#preconditions?" do it "should need at least one item on the :code stack" do @context.clear_stacks lambda{@i1.preconditions?}.should raise_error @context.stacks[:code].push(ValuePoint.new("code", "block {ref a ref b ref c}")) lambda{@i1.preconditions?}.should_not raise_error end end describe "\#cleanup" do it "should remove the first item from the top :code item's backbone block" do @context.stacks[:code].push(ValuePoint.new("code", "block {ref a ref b ref c}")) @i1.go @context.stacks[:code].peek.value.should == "block {\n ref b\n ref c}" end it "should push an empty block {} program if the item isn't a CodeblockPoint" do @context.stacks[:code].push(ValuePoint.new("code", "ref a")) @i1.go @context.stacks[:code].peek.value.should == "block {}" end it "should push an empty block {} program if the item doesn't have enough points to remove 1" do @context.stacks[:code].push(ValuePoint.new("code", "block {}")) @i1.go @context.stacks[:code].peek.value.should == "block {}" end end end end
Version data entries
14 entries across 14 versions & 1 rubygems