Sha256: ada2563af935576737b84949018b0cb2b69351cec75599410c5160d2cdacbdb4

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe Symbiont::WebObjects::TableRow do
  describe "implementation" do
    let(:table_cell) { double('table_cell') }
    let(:table_row_object) { double('table_row_object') }
    
    context "on the watir platform" do
      it "should return a table cell when indexed" do
        table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
        table_row_object.should_receive(:[]).with(1).and_return(table_cell)
        table_row[1].should be_instance_of Symbiont::WebObjects::TableCell
      end
      
      it "should return the number of columns" do
        table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
        table_row_object.stub(:wd).and_return(table_row_object)
        table_row_object.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_object)
        table_row_object.should_receive(:size).and_return(3)
        table_row.columns.should == 3
      end
      
      it "should iterate over the table columns" do
        table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
        table_row.should_receive(:columns).and_return(2)
        table_row.stub(:[]).and_return(table_row_object)
        count = 0
        table_row.each { |e| count += 1 }
        count.should == 2
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
symbiont-0.1.1 spec/symbiont/web_objects/table_row_spec.rb