Sha256: 7531c8f3f59ca56026deaa5a61a147bbbdb7b8b7d72ec0861652fe6bc8bd35c9

Contents?: true

Size: 1.36 KB

Versions: 18

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

Capybara.app = TestApp

describe 'capybara/rspec', :type => :request do
  it "should include Capybara in rspec" 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

feature "Feature DSL" do
  scenario "is pulled in" do
    visit('/foo')
    page.body.should include('Another World')
  end
end

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/capybara-1.1.4/spec/rspec_spec.rb
capybara-1.1.4 spec/rspec_spec.rb
capybara-1.1.3 spec/rspec_spec.rb
nimboids-capybara-1.1.2 spec/rspec_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/capybara-1.1.2/spec/rspec_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/capybara-1.1.2/spec/rspec_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/capybara-1.1.2/spec/rspec_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/capybara-1.1.2/spec/rspec_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/capybara-1.1.2/spec/rspec_spec.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/capybara-1.1.2/spec/rspec_spec.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/capybara-1.1.2/spec/rspec_spec.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/capybara-1.1.2/spec/rspec_spec.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/capybara-1.1.2/spec/rspec_spec.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/capybara-1.1.2/spec/rspec_spec.rb
capybara-1.1.2 spec/rspec_spec.rb
capybara-1.1.1 spec/rspec_spec.rb
capybara-1.1.0 spec/rspec_spec.rb
capybara-1.1.0.rc1 spec/rspec_spec.rb