Sha256: d26b1e03b5be99abc8a6badeb76ea0fd1657fc2c508114be54cca270eed814f0

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe Capybara::Session do
  context 'with mechanize driver' do
    before do
      @session = Capybara::Session.new(:mechanize, TestApp)
      Capybara.default_host = 'http://www.local.com'
    end

    describe '#driver' do
      it "should be a mechanize driver" do
        @session.driver.should be_an_instance_of(Capybara::Mechanize::Driver)
      end
    end

    describe '#mode' do
      it "should remember the mode" do
        @session.mode.should == :mechanize
      end
    end

    describe '#click_link' do
      it "should use data-method if available" do
        @session.visit "/with_html"
        @session.click_link "A link with data-method"
        @session.body.should include('The requested object was deleted')
      end
    end
    
    it "should use the last remote url when following relative links" do
      @session.visit("#{REMOTE_TEST_URL}/relative_link_to_host")
      @session.click_link "host"
      @session.body.should include("Current host is #{REMOTE_TEST_URL}, method get")
    end
    
    it "should use the last remote url when submitting a form with a relative action" do
      @session.visit("#{REMOTE_TEST_URL}/form_with_relative_action_to_host")
      @session.click_button "submit"
      @session.body.should include("Current host is #{REMOTE_TEST_URL}, method post")
    end

    it_should_behave_like "session"
    it_should_behave_like "session without javascript support"
    it_should_behave_like "session with headers support"
    it_should_behave_like "session with status code support"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-mechanize-0.3.0.rc2 spec/session/mechanize_spec.rb
capybara-mechanize-0.3.0.rc1 spec/session/mechanize_spec.rb