Sha256: 56db99f82cbebcce2a93e0a11e264bd94656ac015d147dda6313610b717ce977

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'
require 'capybara/rspec'

Capybara.app = TestApp

describe 'capybara/rspec', :type => :acceptance do
  it "should include Capybara in rpsec" do
    visit('/foo')
    page.body.should include('Another World')
  end

  context "resetting session" do
    it "sets a cookie in one example..." do
      visit('/set_cookie')
      page.body.should include('Cookie set to test_cookie')
    end

    it "...then it is not availbable in the next" do
      visit('/get_cookie')
      page.body.should_not include('test_cookie')
    end
  end

  context "setting the current driver" do
    it "sets the current driver in one example..." do
      Capybara.current_driver = :selenium
    end

    it "...then it has returned to the default in the next example" do
      Capybara.current_driver.should == :rack_test
    end
  end

  it "switches to the javascript driver when giving it as metadata", :js => true do
    Capybara.current_driver.should == Capybara.javascript_driver
  end

  it "switches to the given driver when giving it as metadata", :driver => :culerity do
    Capybara.current_driver.should == :culerity
  end
end

describe 'capybara/rspec', :type => :other do
  it "should not include Capybara" do
    expect { visit('/') }.to raise_error(NoMethodError)
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
capybara-0.4.1.2 spec/rspec_spec.rb
capybara-rails-2-2-0.4.1.1 spec/rspec_spec.rb
rcarvalho-capybara-0.4.1.2 spec/rspec_spec.rb
rcarvalho-capybara-0.4.1.1 spec/rspec_spec.rb
capybara-0.4.1.1 spec/rspec_spec.rb
capybara-0.4.1.rc spec/rspec_spec.rb