Skip to content

Instantly share code, notes, and snippets.

@roelbondoc
Created July 27, 2015 14:42
Show Gist options
  • Save roelbondoc/6367334900ebd5cf37b3 to your computer and use it in GitHub Desktop.
Save roelbondoc/6367334900ebd5cf37b3 to your computer and use it in GitHub Desktop.
require 'test_helper'
class UrlShortenerTest < ActionDispatch::IntegrationTest
test 'it shortens URLs' do
original = 'http://en.wikipedia.org/wiki/Sports_game'
post '/', url: original
assert_response 201
shortened = response.headers['Location']
assert shortened.length < original.length, 'URL is actually shorter'
get '/', shortened: shortened
assert_redirected_to original
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment