> mkdir foo
> cd foo
> gem install bundler
> vi Gemfile

Gemfile

source 'https://rubygems.org'
gem 'rspec', '2.14.1'
gem 'capybara', '2.3.0'
gem 'selenium-webdriver'
> bundle install
> rspec --init
> vi spec/foo_spec.rb

spec/foo_spec.rb

require 'rspec'
require 'capybara/rspec'

require 'rubygems'
require 'capybara'
require 'capybara/dsl'

Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = 'http://www.google.com'

describe 'bar', :type => :feature do
  it 'foo' do
    visit('/')
    expect(page).to have_content 'Google'
  end
end
> rspec foo/foo_spec.rb
.

Finished in 3.33 seconds
1 example, 0 failures

If all goes well should see a few warnings, and a browser briefly popup showing google.com home page.

Links that help
http://stackoverflow.com/questions/3484169/how-to-use-capybara-in-pure-ruby-without-rails

Advertisements