Sha256: e0c3a59aeb75ee828ec23727ee5405c74f267c06a5c9b8cf774754c6838a9444

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

require "spec_helper"
require "hamster/vector"

describe Hamster::Vector do
  let(:vector) { Hamster.vector(*values) }

  describe "#length" do
    let(:length) { vector.length }

    shared_examples "checking size" do
      it "returns the values" do
        expect(length).to eq(size)
      end
    end

    context "with an empty array" do
      let(:values) { [] }
      let(:size) { 0 }

      include_examples "checking size"
    end

    context "with a single item array" do
      let(:values) { %w[A] }
      let(:size) { 1 }

      include_examples "checking size"
    end

    context "with a multi-item array" do
      let(:values) { %w[A B] }
      let(:size) { 2 }

      include_examples "checking size"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-1.0.1.pre.rc2 spec/hamster/vector/length_spec.rb
hamster-1.0.1.pre.rc.1 spec/hamster/vector/length_spec.rb