summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/v1/licenses_controller.rb2
-rw-r--r--spec/controllers/v1/liceneses_controller_spec.rb12
2 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/v1/licenses_controller.rb b/app/controllers/v1/licenses_controller.rb
index 0a076c8..c62c78b 100644
--- a/app/controllers/v1/licenses_controller.rb
+++ b/app/controllers/v1/licenses_controller.rb
@@ -10,7 +10,7 @@ class V1::LicensesController < ApplicationController
def show
@license = License.find(params[:id])
- render nothing: true
+ render json: @license
end
private
diff --git a/spec/controllers/v1/liceneses_controller_spec.rb b/spec/controllers/v1/liceneses_controller_spec.rb
index bfc3618..0f08c05 100644
--- a/spec/controllers/v1/liceneses_controller_spec.rb
+++ b/spec/controllers/v1/liceneses_controller_spec.rb
@@ -39,10 +39,18 @@ describe V1::LicensesController do
end
describe :show do
- it "returns the correct license" do
- license = License.create
+ let(:license) { License.create }
+
+ before :each do
xhr :get, :show, id: license.id
+ end
+
+ it "returns the correct license" do
assigns(:license).should == license
end
+
+ it "returns a json response" do
+ expect(-> { JSON.parse(response.body) }).not_to raise_error
+ end
end
end