feat: Links controller

Show method, Home page, redirection validation

LinksController show method
This commit is contained in:
Juan Rodriguez
2021-06-13 20:34:41 -05:00
parent 7e81f47473
commit d72ad2d43b
7 changed files with 66 additions and 13 deletions
+23
View File
@@ -0,0 +1,23 @@
# frozen_string_literal: true
require 'test_helper'
class LinksControllerTest < ActionDispatch::IntegrationTest
test 'Should get Home page' do
get '/'
assert_response :success, 'Not rendered home page'
end
test 'Should return 404 for unavailable slug' do
get '/test'
assert_response :not_found, 'Not rendered not found'
end
test 'Should redirect from slug to url' do
link = links(:one)
slug = link.slug
get short_url(slug: slug)
assert_redirected_to link.url, 'Not redirected to link url'
end
end