Sha256: 60c806dacaa788a6e270af30cb721b1ff32559292bb983931aa307d613be9d38

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

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

describe "ClickableElement" do

  before :each do
    browser.goto(WatirSpec.files + "/non_control_elements.html")
  end

  describe "#click_and_attach" do
    it 'opens a page in a new browser with the same options' do
      b = browser.link(:name, /bad_attribute/).click_and_attach
      b.text.include?("User administration").should be_true # to make sure it is open.
      b.options.should == browser.options
      b.cookies.should == browser.cookies
    end

    it "opens the page in a new browser with the same cookies" do
      browser.add_cookie("localhost", "foo", "bar")
      old_cookies = browser.cookies
      old_cookies.should_not be_empty

      browser.goto(WatirSpec.files + "/non_control_elements.html")
      b = browser.link(:name, /bad_attribute/).click_and_attach

      b.should_not == browser
      b.cookies.should == old_cookies
    end
  end

  describe "#download" do
    it 'returns a click-opened page as io' do
      expected = File.read "#{WatirSpec.files}/forms_with_input_elements.html".sub("file://", '')

      browser.link(:name, /bad_attribute/).download.read.should == expected
      browser.link(:name, /bad_attribute/).should exist
    end
  end

end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
drnic-celerity-0.0.6.17 spec/clickable_element_spec.rb
jarib-celerity-0.0.6.19 spec/clickable_element_spec.rb
jarib-celerity-0.0.7.1 spec/clickable_element_spec.rb
celerity-0.0.7.2 spec/clickable_element_spec.rb
celerity-0.0.7 spec/clickable_element_spec.rb