Skip to content

Instantly share code, notes, and snippets.

@ymek
Created August 22, 2013 19:04
Show Gist options
  • Select an option

  • Save ymek/6311390 to your computer and use it in GitHub Desktop.

Select an option

Save ymek/6311390 to your computer and use it in GitHub Desktop.
Example subdomain integration test
require 'test_helper'
class Api::UsersTest < ActionDispatch::IntegrationTest
def setup
host! 'api.host.com'
end
test 'get /v1/users/1.json' do
user = users(:one)
get "/v1/users/#{user.id}.json"
assert_response :success
assert body.eql?(user.to_json)
assert JSON.parse(response.body)['username'].eql?(user.username)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment