Sha256: 6f8e19ec1c372feccc0bda1505112e03672dc965cb8508369db2f66dec4ef7a1

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

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

describe "SelectLists" do

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

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

  describe "#length" do
    it "returns the correct number of select lists on the page" do
      @browser.select_lists.length.should == 4
    end
  end

  describe "#[]" do
    it "returns the correct item" do
      @browser.select_lists[1].value.should == "2"
      @browser.select_lists[1].name.should == "new_user_country"
      @browser.select_lists[1].type.should == "select-one"
      @browser.select_lists[2].type.should == "select-multiple"
    end
  end

  describe "#each" do
    it "iterates through the select lists correctly" do
      index=1
      @browser.select_lists.each do |l|
        @browser.select_list(:index, index).name.should == l.name
        @browser.select_list(:index, index).id.should ==  l.id
        @browser.select_list(:index, index).type.should == l.type
        @browser.select_list(:index, index).value.should == l.value
        index += 1
      end
      (index - 1).should == @browser.select_lists.length
    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/select_lists_spec.rb