Sha256: f76cc092edfeebb95f90513f23796724e9af0d42bd9fbe655c3f16dbefb0eaeb

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require_relative "../lib/next_number_positioner"
require_relative "custom_matchers"

describe NextNumberPositioner do

  include CustomMatchers

  before(:each) do
    @number_adder = NextNumberPositioner.new
  end

  it "will always add to the one cell provided" do
    expect(@number_adder.select_position([[0,1]])).to eq([0,1])
  end

  it "will always return one element when given more candidates" do
    #Since it returns one of the encapsulated lists the size should be 2
    expect(@number_adder.select_position([[0,0], [0,1]]).size).to eq(2)
    expect(@number_adder.select_position([[0,0], [0,1], [0,2]]).size).to eq(2)
    expect(@number_adder.select_position([[0,0], [0,1], [0,2], [0,3]]).size).to eq(2)
  end

  it "will always return a valid candidate" do
    expect(@number_adder.select_position([[0,0], [0,1]])).to be_one_of([[0,0], [0,1]])
    expect(@number_adder.select_position([[0,0], [0,1], [0,2]])).to be_one_of([[0,0], [0,1], [0,2]])
    expect(@number_adder.select_position([[0,0], [0,1], [0,2], [0,3]])).to be_one_of([[0,0], [0,1], [0,2], [0,3]])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
threesmodel-0.0.3 spec/next_number_positioner_spec.rb