Skip to content
Snippets Groups Projects
Commit 4c1d38ad authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'show_score' into 'master'

Added show action to Score



See merge request !288
parents 52a6eb9a 48fbf58c
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, status: :ok
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,13 @@ class V1::ScoresControllerTest < ActionController::TestCase
skip
end
test 'should show score' do
auth_application
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