Sha256: 0750a621158bc928c9c43ea19931af66e2b587be0cba6fc7bbd0f40e60ac805b

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

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

describe "SelectLists" do
  
  before :all do
    @browser = Browser.new
  end

  before :each do
    @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
  end
  
  describe "#length" do
    it "should return the correct number of select lists on the page" do
      @browser.select_lists.length.should == 4
    end
  end
  
  describe "#[]" do
    it "should return 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 "should iterate 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
celerity-0.0.4 spec/select_lists_spec.rb