summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-20 19:52:51 -0700
committermo khan <mo@mokhan.ca>2014-02-20 19:52:51 -0700
commitcdfc77e265a9720d5a6207447b84629940e3efa0 (patch)
treef8b4e6513bd178c0219527e97616d449211e62a4
parent60f1cea60b2ba69c21620eb244a0d7c102859830 (diff)
create show action.
-rw-r--r--app/controllers/v1/licenses_controller.rb5
-rw-r--r--spec/controllers/v1/liceneses_controller_spec.rb8
2 files changed, 13 insertions, 0 deletions
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