Sha256: 7e69d717d2c8ec3c255a067ffbbc711bfb69b9d16c5f583b3780e6a5c034bf97

Contents?: true

Size: 1.39 KB

Versions: 9

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Capybara do

  describe 'default_wait_time' do
    after do
      Capybara.default_wait_time = @previous_default_time
    end

    it "should be changeable" do
      @previous_default_time = Capybara.default_wait_time
      Capybara.default_wait_time = 5
      Capybara.default_wait_time.should == 5
    end
  end

  describe '.register_driver' do
    it "should add a new driver" do
      Capybara.register_driver :schmoo do |app|
        Capybara::RackTest::Driver.new(app)
      end
      session = Capybara::Session.new(:schmoo, TestApp)
      session.visit('/')
      session.body.should include("Hello world!")
    end
  end

  describe ".server" do
    after do
      Capybara.server {|app, port| Capybara.run_default_server(app, port)}
    end

    it "should default to a proc that calls run_default_server" do
      mock_app = mock('app')
      Capybara.should_receive(:run_default_server).with(mock_app, 8000)
      Capybara.server.call(mock_app, 8000)
    end

    it "should return a custom server proc" do
      server = lambda {|app, port|}
      Capybara.server(&server)
      Capybara.server.should == server
    end
  end
end

describe Capybara::Session do
  context 'with non-existant driver' do
    it "should raise an error" do
      expect {
        Capybara::Session.new(:quox, TestApp).driver
      }.to raise_error(Capybara::DriverNotFoundError)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/spec/capybara_spec.rb
capybara-2.1.0 spec/capybara_spec.rb
capybara-2.1.0.rc1 spec/capybara_spec.rb
capybara-2.0.3 spec/capybara_spec.rb
capybara-2.1.0.beta1 spec/capybara_spec.rb
capybara-2.0.2 spec/capybara_spec.rb
capybara-2.0.1 spec/capybara_spec.rb
capybara-2.0.0 spec/capybara_spec.rb
capybara-2.0.0.beta4 spec/capybara_spec.rb