Created
October 29, 2011 01:37
-
-
Save rimian/1323971 to your computer and use it in GitHub Desktop.
Set headers capybara / mechanize
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
#env.rb | |
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'capybara/cucumber' | |
require 'selenium-webdriver' | |
require 'capybara/mechanize/cucumber' | |
World do | |
Capybara.default_driver = :mechanize | |
Capybara.javascript_driver = :selenium | |
Capybara.app_host = 'http://example.com' | |
Capybara | |
end | |
# step definition | |
When /^I visit some URL$/ do | |
headers = { | |
'foo' => 'bar' | |
} | |
@agent = Mechanize.new | |
@page = @agent.get('http://example.com', [], nil, headers) | |
end | |
Then /^I something should have happened$/ do | |
@page.body.should have_some_thing | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment