Sha256: 723c1cc50d159f9da2b893d2f8193fe5a6d0870d3ca80b77cc0aeb7b7624d766

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require_relative '../quiz'

describe "#spiral" do
  let(:small_spiral) do
    [[1,2,3],
     [8,9,4],
     [7,6,5]]
  end

  let(:big_spiral) do
    [[1,2,3,4],
     [5,9,4,2],
     [7,6,5,9],
     [9,4,2,0],
     [4,5,1,2]]
  end

  it "should have a method defined named spiral" do
    expect(method(:spiral))
  end

  it "should have one parameter called two_d_array" do
    parameters = method(:spiral).parameters
    expect(parameters[0]).to include(:two_d_array)
  end

  it "should return an array of the spiral unwrapped" do
    expect(spiral [[]]).to eq []
    expect(spiral [[1]]).to eq [1]
    expect(spiral(small_spiral)).to eq [1,2,3,4,5,6,7,8,9]
    expect(spiral(big_spiral)).to eq [1,2,3,4,2,9,0,2,1,5,4,9,7,5,9,4,5,2,4,6]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spiral-path-bm-1.0.0 spec/spiral-path-bm_spec.rb