Skip to content

Test::Unit and Capybara

testingbot edited this page May 17, 2012 · 1 revision

To run Test::Unit and Capybara together, please see this example:

require 'rubygems'
require 'test/unit'
require 'capybara'
require 'testingbot'
require 'testingbot/capybara'

TestingBot::config do |config|
  config[:desired_capabilities] = { :browserName => "firefox", :version => 9, :platform => "WINDOWS" }
end

class CapybaraTestCase < Test::Unit::TestCase
  include Capybara::DSL

  def setup
    Capybara.current_driver = :testingbot
    Capybara.app_host = "http://testingbot.com"
  end

  def teardown
    Capybara.reset_sessions!
    Capybara.use_default_driver
  end

  def test_google
    visit("/")
  end
end