spec/watirspec/elements/thead_spec.rb in watir-6.13.0 vs spec/watirspec/elements/thead_spec.rb in watir-6.14.0

- old
+ new

@@ -1,26 +1,25 @@ -require "watirspec_helper" +require 'watirspec_helper' -describe "TableHeader" do - +describe 'TableHeader' do before :each do - browser.goto(WatirSpec.url_for("tables.html")) + browser.goto(WatirSpec.url_for('tables.html')) end - describe "#exists?" do - it "returns true if the table theader exists (page context)" do + describe '#exists?' do + it 'returns true if the table theader exists (page context)' do expect(browser.thead(id: 'tax_headers')).to exist expect(browser.thead(id: /tax_headers/)).to exist expect(browser.thead(index: 0)).to exist expect(browser.thead(xpath: "//thead[@id='tax_headers']")).to exist end - it "returns the first thead if given no args" do + it 'returns the first thead if given no args' do expect(browser.thead).to exist end - it "returns true if the table theader exists (table context)" do + it 'returns true if the table theader exists (table context)' do expect(browser.table(index: 0).thead(id: 'tax_headers')).to exist expect(browser.table(index: 0).thead(id: /tax_headers/)).to exist expect(browser.table(index: 0).thead(index: 0)).to exist expect(browser.table(index: 0).thead(xpath: "//thead[@id='tax_headers']")).to exist end @@ -43,44 +42,43 @@ expect { browser.thead(id: 3.14).exists? }.to raise_error(TypeError) expect { browser.table(index: 0).thead(id: 3.14).exists? }.to raise_error(TypeError) end end - describe "#[]" do - it "returns the row at the given index (page context)" do + describe '#[]' do + it 'returns the row at the given index (page context)' do expect(browser.thead(id: 'tax_headers')[0].id).to eq 'thead_row_1' expect(browser.thead(id: 'tax_headers')[0][1].text).to eq 'Before income tax' expect(browser.thead(id: 'tax_headers')[0][2].text).to eq 'Income tax' end - it "returns the row at the given index (table context)" do + it 'returns the row at the given index (table context)' do expect(browser.table(index: 0).thead(id: 'tax_headers')[0].id).to eq 'thead_row_1' expect(browser.table(index: 0).thead(id: 'tax_headers')[0][1].text).to eq 'Before income tax' expect(browser.table(index: 0).thead(id: 'tax_headers')[0][2].text).to eq 'Income tax' end end - describe "#row" do - it "finds the first row matching the selector" do - row = browser.thead(id: 'tax_headers').row(class: "dark") - expect(row.id).to eq "thead_row_1" + describe '#row' do + it 'finds the first row matching the selector' do + row = browser.thead(id: 'tax_headers').row(class: 'dark') + expect(row.id).to eq 'thead_row_1' end end - describe "#rows" do - it "finds rows matching the selector" do - rows = browser.thead(id: 'tax_headers').rows(class: "dark") + describe '#rows' do + it 'finds rows matching the selector' do + rows = browser.thead(id: 'tax_headers').rows(class: 'dark') expect(rows.size).to eq 1 - expect(rows.first.id).to eq "thead_row_1" + expect(rows.first.id).to eq 'thead_row_1' end end - describe "#strings" do - it "returns the text of child cells" do + describe '#strings' do + it 'returns the text of child cells' do expect(browser.thead(id: 'tax_headers').strings).to eq [ - ["", "Before income tax", "Income tax", "After income tax"] + ['', 'Before income tax', 'Income tax', 'After income tax'] ] end end - end