From cdfc77e265a9720d5a6207447b84629940e3efa0 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 20 Feb 2014 19:52:51 -0700 Subject: create show action. --- app/controllers/v1/licenses_controller.rb | 5 +++++ spec/controllers/v1/liceneses_controller_spec.rb | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/app/controllers/v1/licenses_controller.rb b/app/controllers/v1/licenses_controller.rb index 36ae54c..0a076c8 100644 --- a/app/controllers/v1/licenses_controller.rb +++ b/app/controllers/v1/licenses_controller.rb @@ -8,6 +8,11 @@ class V1::LicensesController < ApplicationController render json: @licenses end + def show + @license = License.find(params[:id]) + render nothing: true + end + private def prepare_pagination diff --git a/spec/controllers/v1/liceneses_controller_spec.rb b/spec/controllers/v1/liceneses_controller_spec.rb index b2eb705..bfc3618 100644 --- a/spec/controllers/v1/liceneses_controller_spec.rb +++ b/spec/controllers/v1/liceneses_controller_spec.rb @@ -37,4 +37,12 @@ describe V1::LicensesController do -> { JSON.parse(response.body) }.should_not raise_error end end + + describe :show do + it "returns the correct license" do + license = License.create + xhr :get, :show, id: license.id + assigns(:license).should == license + end + end end -- cgit v1.2.3