Sha256: 5ae2ba2283cd222a263826d82e7961ba24269118cc4fff855b403c61d1e1a3b8

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

describe Poner do

  let(:context) { ProgramExecutionContext.for double('GobstonesProgram') }
  let(:green) { Verde.new }

  it "should execute" do
    Poner.new(green).evaluate(context)

    expect(context.head.number_of_balls(green)).to eq(1)
  end

  it "should undo" do
    context.head.put green

    Poner.new(green).undo context

    expect(context.head.number_of_balls(green)).to eq(0)
  end

  it "should return the opposite cmd" do
    expect(Poner.new(green).opposite).to eq(Sacar.new(green))
  end

  it "should fail if types don't match" do
    expect { Poner.new(Norte.new).evaluate(context) }.
      to raise_error(GobstonesTypeError, /is not a color/)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gobstones-0.0.1.1 spec/lang/commands/poner_cmd_spec.rb