Skip to content

Instantly share code, notes, and snippets.

@paulca
Created March 24, 2010 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulca/342890 to your computer and use it in GitHub Desktop.
Save paulca/342890 to your computer and use it in GitHub Desktop.
require 'webrat'
Webrat.configure do |config|
config.mode = :mechanize
end
class MechanizeWorld < Webrat::MechanizeAdapter
include Webrat::Matchers
include Webrat::Methods
# no idea why we need this but without it response_code is not always recognized
Webrat::Methods.delegate_to_session :response_code, :response_body
end
World do
MechanizeWorld.new
end
Feature: Google
As a user
I want to load google
Scenario: Google
When I go to http://www.google.com
Then I should see "Google"
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'uri'
When /^(?:|I )go to (.+)$/ do |page_name|
visit page_name
end
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
response_body.should contain(text)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment