Sha256: 312a3cc7b7f13189b1043f9735031cd4f1c877335e2140d23d8becce8604f06c

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

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

describe "H1s", "H2s", "H3s", "H4s", "H5s", "H6s" 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 h1s" do
      @browser.h2s.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the h1 at the given index" do
      @browser.h1s[1].id.should == "first_header"
    end
  end

  describe "#each" do
    it "iterates through header collections correctly" do
      lengths = (1..6).collect do |i|
        collection = @browser.send(:"h#{i}s")
        collection.each_with_index do |h, index|
          h.name.should == @browser.send(:"h#{i}", :index, index+1).name
          h.id.should == @browser.send(:"h#{i}", :index, index+1).id
          h.value.should == @browser.send(:"h#{i}", :index, index+1).value
        end
        collection.length
      end
      lengths.should == [2, 9, 2, 1, 1, 2]
    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/hns_spec.rb