Skip to content
Snippets Groups Projects
Commit 74211741 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Added show action to scores

parent 52a6eb9a
No related branches found
No related tags found
No related merge requests found
class V1::ScoresController < ApplicationController
before_action :set_score, only: [:update]
before_action :set_score, only: [:show,:update]
before_action :authenticate_user!, only: [:update]
# GET v1/scores
......@@ -8,8 +8,14 @@ class V1::ScoresController < ApplicationController
render json: Score.order(:name).includes(:score_user_categories).sort{|score| score.score_user_categories.size}.reverse
end
# PUT/PATCH /v1/institutions/1
# PUT/PATCH /v1/institutions/1.json
# GET /scores/1
# GET /scores/1.json
def show
render json: @score
end
# PUT/PATCH /v1/scores/1
# PUT/PATCH /v1/scores/1.json
def update
if @score.update(score_params)
render json: @score, status: :ok
......
......@@ -102,7 +102,7 @@ Rails.application.routes.draw do
resources :mime_types, except: [:new, :edit]
resources :object_types, except: [:new, :edit]
resources :roles, except: [:new, :edit]
resources :scores, only: [:index, :update]
resources :scores, only: [:index, :show, :update]
post '/package', to: 'packages#link'
end
......
......@@ -8,6 +8,12 @@ class V1::ScoresControllerTest < ActionController::TestCase
skip
end
test 'should show score' do
score = scores(:score_19)
get :show, id: score.id
assert_response :ok
end
test 'should put score to update and return :ok code' do
auth_request users(:jack)
score = scores(:score_19)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment