github
0 of 18 new or added lines in 4 files covered. (0.0%)
3922 existing lines in 105 files now uncovered.0 of 4086 relevant lines covered (0.0%)
0.0 hits per line
1 |
# frozen_string_literal: true
|
|
2 |
|
|
UNCOV
3
|
class ApplicationController < ActionController::API |
× |
4 |
|
|
UNCOV
5
|
include Swaggerable
|
× |
6 |
|
|
UNCOV
7
|
before_action :set_user_current
|
× |
8 |
|
|
UNCOV
9
|
private |
× |
10 |
|
|
UNCOV
11
|
def not_found |
× |
12 |
raise(ActionController::RoutingError, |
× |
UNCOV
13
|
"No route matches [#{request.headers['REQUEST_METHOD']}] " +
|
× |
UNCOV
14
|
request.headers['PATH_INFO'].inspect)
|
× |
UNCOV
15
|
end
|
× |
16 |
|
|
UNCOV
17
|
def render_unauthorized |
× |
UNCOV
18
|
headers['WWW-Authenticate'] = 'Token realm="Application"' |
× |
UNCOV
19
|
render json: { errors: 'Not authenticated' }, status: :unauthorized |
× |
UNCOV
20
|
end
|
× |
21 |
|
|
UNCOV
22
|
def current_user |
× |
UNCOV
23
|
defined?(@current_user) ? @current_user : @current_user = fetch_current_user |
× |
UNCOV
24
|
end
|
× |
25 |
|
|
UNCOV
26
|
def fetch_current_user |
× |
UNCOV
27
|
Auth::ApiToken.new(request).fetch_user || |
× |
UNCOV
28
|
Auth::AccessCode.new(request).fetch_user |
× |
UNCOV
29
|
end
|
× |
30 |
|
|
UNCOV
31
|
def set_user_current |
× |
UNCOV
32
|
User.current = current_user
|
× |
UNCOV
33
|
end
|
× |
34 |
|
|
UNCOV
35
|
end
|
× |