-
-
Save jamiecobbett/138436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrat' | |
require 'webrat/mechanize' | |
include Webrat::Methods | |
include Webrat::Matchers | |
Webrat.configure do |config| | |
config.mode = :mechanize | |
end | |
require 'webrat/core/matchers' | |
class MechanizeWorld < Webrat::MechanizeSession | |
require 'spec' | |
include Spec::Matchers | |
end | |
World do | |
MechanizeWorld.new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Google | |
In order to test a remote site | |
I surf to google | |
And take a look | |
Scenario: Surf to google | |
When I hit the google homepage | |
And I execute a query | |
Then I should see some results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I hit the google homepage$/ do | |
visit "http://google.com/" | |
end | |
When /^I execute a query$/ do | |
fill_in "q", :with=>"GoGaRuCo" | |
click_button "Google Search" | |
end | |
Then /^I should see some results$/ do | |
dom.search("h3 a").each_with_index do |link, i| | |
announce "#{i+1} #{link['href']}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment