0
0
Fork 0

Add tests for intents_controller (#7763)

This commit is contained in:
Shuhei Kitagawa 2018-06-10 05:47:50 +09:00 committed by Eugen Rochko
parent 10f51c9886
commit 7086aa598b
2 changed files with 67 additions and 2 deletions

View file

@ -1,9 +1,10 @@
# frozen_string_literal: true
class IntentsController < ApplicationController
def show
uri = Addressable::URI.parse(params[:uri])
before_action :check_uri
rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri
def show
if uri.scheme == 'web+mastodon'
case uri.host
when 'follow'
@ -15,4 +16,18 @@ class IntentsController < ApplicationController
not_found
end
private
def check_uri
not_found if uri.blank?
end
def handle_invalid_uri
not_found
end
def uri
@uri ||= Addressable::URI.parse(params[:uri])
end
end