Skip to content

Instantly share code, notes, and snippets.

@radamant
Created June 18, 2009 21:39
Show Gist options
  • Save radamant/132206 to your computer and use it in GitHub Desktop.
Save radamant/132206 to your computer and use it in GitHub Desktop.
require 'webrat'
Webrat.configure do |config|
config.mode = :sinatra
end
class WebratTester
include Webrat::Methods
include Webrat::Matchers
def test_it
visit "http://www.google.com"
end
end
#this failed
>> t = WebratTester.new
=> #<WebratTester:0x1c95828>
>> t.test_it
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
#Cucumber::Rails.use_transactional_fixtures
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
# Load Lookup Data
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, 'db', 'fixtures', 'lookup')
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map { |f| File.basename(f, '.yml') }
Fixtures.create_fixtures(fixtures_folder, fixtures)
require 'webrat'
Webrat.configure do |config|
config.mode = :rails
end
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment