Sha256: 64d9500286f404cc774b78c1cf74a58c488ec94dcee67d9c118c8a5e564de1a2

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "Links" do

  before :all do
    @browser = Browser.new(BROWSER_OPTIONS)
  end

  before :each do
    @browser.goto(HTML_DIR + "/non_control_elements.html")
  end

  describe "#length" do
    it "returns the number of links" do
      @browser.links.length.should == 4
    end
  end

  describe "#[]" do
    it "returns the link at the given index" do
      @browser.links[3].id.should == "link_3"
    end

    it "returns a Link object also when the index is out of bounds" do
      @browser.links[2000].should_not be_nil
    end
  end

  describe "#each" do
    it "iterates through links correctly" do
      index = 0
      @browser.links.each do |c|
        index += 1
        c.name.should == @browser.link(:index, index).name
        c.id.should == @browser.link(:index, index).id
        c.value.should == @browser.link(:index, index).value
      end
      @browser.links.length.should == index
    end
  end

  after :all do
    @browser.close
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caius-celerity-0.0.6.11 spec/links_spec.rb