Sha256: e864727ddf8786f89e08c8128e60fc6d382b7ca5e94199840001bb6d2d50f756

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

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

describe "TextFields" 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 number of text fields" do
      @browser.text_fields.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the text field at the given index" do
      @browser.text_fields[1].id.should == "new_user_first_name"
      @browser.text_fields[2].id.should == "new_user_last_name"
      @browser.text_fields[3].id.should == "new_user_email"
    end
  end

  describe "#each" do
    it "iterates through text fields correctly" do
      index = 1
      @browser.text_fields.each do |r|
        r.name.should == @browser.text_field(:index, index).name
        r.id.should ==  @browser.text_field(:index, index).id
        r.value.should == @browser.text_field(:index, index).value
        index += 1
      end
      @browser.text_fields.length.should == index - 1
    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/text_fields_spec.rb