Sha256: d1e17cd9a7e1df8be04c6871b781c81e571b3f9e48f0e7c8a9d1f0aa722e7842

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

describe Poner do

  let(:context) { clean_context }

  it "puts a ball of the given color in the current cell when evaluating" do
    Poner.new(verde).evaluate(context)

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

  it "undoes the command" do
    context.head.put verde

    Poner.new(verde).undo context

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

  it "returns the opposite command" do
    expect(Poner.new(verde).opposite).to eq(Sacar.new(verde))
  end

  it "fails if the argument is not a color" do
    expect { Poner.new(norte).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.2 spec/lang/commands/poner_cmd_spec.rb