> 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
Feb 03, 2015 @ 07:58:38
Thanks , it helped a lot
Feb 08, 2015 @ 09:24:34
Most welcome 🙂
Feb 02, 2019 @ 23:41:06
unfortunately, didn’t work with localhost 😦