Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run a standalone Capybara test?

Tags:

ruby

capybara

I'm trying to run a test against a remote server. i.e:

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

Capybara.default_driver = :selenium
Capybara.app_host = 'http://www.google.com'


module MyCapybaraTest
  include Capybara

  def test_google
    visit('/')
  end
end

question is, how do you run it?

like image 847
SergioB Avatar asked Nov 03 '10 02:11

SergioB


1 Answers

Save

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

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

module MyCapybaraTest
  class Test
    include Capybara::DSL
    def test_google
      visit('/')
    end
  end
end

t = MyCapybaraTest::Test.new
t.test_google

to test.rb and simply: ruby test.rb

like image 167
Pål Brattberg Avatar answered Oct 23 '22 01:10

Pål Brattberg