Sha256: ce77d9bc24cdbf63cfbc5a24982c0e390e25462a5bda090b43e66e0b81c7c1dc

Contents?: true

Size: 1023 Bytes

Versions: 4

Compression:

Stored size: 1023 Bytes

Contents

require 'spec_helper'

describe ExcelAbstraction::Row do
  subject { described_class.new }

  describe "enumeration" do
    before :each do
      subject << {position: 0, val: "foo"}
      subject << {position: 1, val: "bar"}
      subject << {position: 2, val: "baz"}
    end

    it "enumerates over the cell references in the range" do
      expect(subject.reduce(""){ |str, cell| str += cell.val }).to eq "foobarbaz"
    end
  end

  describe "#[]" do
    before :each do
      subject << {position: 0, val: "foo"}
      subject << {position: 1, val: "bar"}
      subject << {position: 2, val: "baz"}
    end

    it "returns the cell with the given position" do
      expect(subject[1].val).to eq("bar")
    end
  end

  describe "#<<" do
    before :each do
      subject << {position: 0, val: "foo"}
    end

    context "when the cell to be inserted is in the same row" do
      it "inserts the cell" do
        subject << {position: 1, val: "bar"}
        expect(subject.count).to eq 2
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
excel_templating-0.4.2 spec/excel_abstraction/row_spec.rb
excel_templating-0.4.1 spec/excel_abstraction/row_spec.rb
excel_templating-0.4.0 spec/excel_abstraction/row_spec.rb
excel_templating-0.3.2 spec/excel_abstraction/row_spec.rb