From 1388b346450b975703b7890eb87505e975713c22 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 08:30:56 -0700 Subject: add the license status to the json response. --- spec/views/v1/licenses/show.json.jbuilder_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec') diff --git a/spec/views/v1/licenses/show.json.jbuilder_spec.rb b/spec/views/v1/licenses/show.json.jbuilder_spec.rb index db8730f..404a514 100644 --- a/spec/views/v1/licenses/show.json.jbuilder_spec.rb +++ b/spec/views/v1/licenses/show.json.jbuilder_spec.rb @@ -10,6 +10,7 @@ describe 'v1/licenses/show' do let(:public_license) { License.new(id: SecureRandom.uuid, company: company, applicant: user, location: location, issued_at: 2.days.ago, expired_at: 1.day.from_now, well_type: well_type) } before :each do + public_license.stub(:status).and_return('active') assign(:license, public_license) render end @@ -41,12 +42,17 @@ describe 'v1/licenses/show' do result["location"]["longitude"].should == location.longitude result["location"]["township"].should == location.township end + + it "includes the license status" do + result['status'].should == 'active' + end end context "for confidential licenses" do let(:confidential_license) { License.new(confidential: true, company: company, applicant: user, location: location, well_type: well_type) } before :each do + confidential_license.stub(:status).and_return('confidential') assign(:license, confidential_license) render end @@ -66,5 +72,9 @@ describe 'v1/licenses/show' do it "should hide the company name" do result["company"]["name"].should == "CONFIDENTIAL" end + + it "includes the license status" do + result['status'].should == 'confidential' + end end end -- cgit v1.2.3