Created
November 25, 2011 16:24
-
-
Save aokolish/1393902 to your computer and use it in GitHub Desktop.
How to get tests running on an external site that uses HTTP authentication
This file contains hidden or 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
# /spec/example_spec.rb | |
require 'rspec' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'capybara-webkit' | |
require_relative '../spec_helper.rb' | |
Capybara.app_host = "http://username:[email protected]" | |
describe "The homepage", :js => true do | |
before :all do | |
Capybara.current_driver = :webkit | |
end | |
it "has header links" do | |
# puts Capybara.current_driver | |
visit "/" | |
page.should have_content "Some Text" | |
page.should have_content "Other Text" | |
end | |
it "allows you to sign up for emails" do | |
click_link "signup" | |
find('#emailsignupcontainer').should be_visible | |
fill_in 'elementId', :with => 'bob' | |
fill_in 'elementId', :with => '[email protected]' | |
click_link 'Sign Up' | |
page.should have_content "Thank you for signing up!" | |
end | |
end |
This file contains hidden or 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
# /Gemfile | |
source 'http://rubygems.org' | |
gem 'rspec' | |
gem 'capybara' | |
gem 'selenium-webdriver' | |
gem 'capybara-webkit' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment