Sha256: bc6abb06a249e7a7d06f85bbaf15a1cd6a9eb22a3a2ef6cea469f054e315d791

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

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

describe "Buttons" 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 buttons" do
      @browser.buttons.length.should == 8
    end
  end

  describe "#[]" do
    it "returns the button at the given index" do
      @browser.buttons[1].title.should == "Submit the form"
    end
  end

  describe "#first" do
    it "returns the first element in the collection" do
      @browser.buttons.first.value.should == @browser.buttons[1].value
    end
  end

  describe "#last" do
    it "returns the last element in the collection" do
      @browser.buttons.last.value.should == @browser.buttons[0].value
    end
  end

  describe "#each" do
    it "iterates through buttons correctly" do
      @browser.buttons.each_with_index do |b, index|
        b.name.should == @browser.button(:index, index+1).name
        b.id.should == @browser.button(:index, index+1).id
        b.value.should == @browser.button(:index, index+1).value
      end
    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/buttons_spec.rb