Skip to content

Instantly share code, notes, and snippets.

@iamnader
Created August 26, 2010 16:55
Show Gist options
  • Save iamnader/551764 to your computer and use it in GitHub Desktop.
Save iamnader/551764 to your computer and use it in GitHub Desktop.
# /test/integration/subdomain_test.rb
require 'integration_test_helper'
class SubdomainTest < ActionController::IntegrationTest
test "simple subdomain test" do
subdomain = "something"
# this test passes using selenium, fails using the default envjs
#Capybara.current_driver = :selenium
Capybara.app_host = "http://#{subdomain}.lvh.me:9887"
visit root_path
assert current_url.include?(subdomain)
end
end
# /test/integration_test_helper.rb
require "test_helper"
require "capybara/rails"
module ActionController
class IntegrationTest
include Capybara
def setup
Capybara.reset_sessions!
end
end
Capybara.javascript_driver = :envjs
Capybara.default_host = "lvh.me"
Capybara.app_host = "http://lvh.me:9887"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment