Sha256: edd49a04b037f9e772f29921b47fec16259bfc33f5634c12117e4cb1fe643a4e

Contents?: true

Size: 956 Bytes

Versions: 3

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'
require 'druid/elements'

describe Druid::Elements::TableRow do
  let(:table_cell) { double('table_cell') }
  let(:element) { double 'element' }
  let(:table_row) { Druid::Elements::TableRow.new(element) }

  describe "interface" do

    before(:each) do
      allow(element).to receive(:find_elements).and_return(element)
      allow(element).to receive(:cells).and_return(Array.new(2, Watir::TableCell))
    end

    it "should return a table cell when indexed" do
      expect(table_row[1]).to be_instance_of Druid::Elements::TableCell
    end

    it "should return the number of columns" do
      expect(table_row.columns).to eql 2
    end

    it "should iterate  over the table columns" do
      count = 0
      table_row.each{ count += 1}
      expect(count).to eql 2
    end

    it "should register with tag_name :tr" do
      expect(Druid::Elements.element_class_for(:tr)).to be Druid::Elements::TableRow
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
druid-s-1.0.0 spec/druid/elements/table_row_spec.rb
druid-ts-1.2.6 spec/druid/elements/table_row_spec.rb
druid-ts-1.2.5 spec/druid/elements/table_row_spec.rb