Skip to content

RSpec 2, Capybara and Rails

testingbot edited this page Apr 9, 2012 · 1 revision

To run Selenium tests on your Rails code with RSpec you will need to install the rspec-rails gem. If you use Capybara a rack server will be started at the beginning of your test.

You can use our Tunnel (testingbot.com/support/other/tunnel) to run tests on your local machine on our Grid.

require 'spec_helper'

TestingBot::config do |config|
  config[:desired_capabilities] = { :browserName => "firefox", :version => 9, :platform => "WINDOWS", :localhost => "YES" }
  config.require_tunnel # need a tunnel to run a localhost test
end

describe 'home page' do
  before :all do
    Capybara.server_port = 3011
    Capybara.current_driver = :testingbot
    Capybara.app_host = "http://127.0.0.1:3011"
  end

  it "shows the home page", :type => :request do
    visit '/'
    page.should have_content('Selenium')
  end
end
Clone this wiki locally