diff options
| -rw-r--r-- | app/views/v1/licenses/_license.json.jbuilder | 1 | ||||
| -rw-r--r-- | spec/views/v1/licenses/show.json.jbuilder_spec.rb | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/views/v1/licenses/_license.json.jbuilder b/app/views/v1/licenses/_license.json.jbuilder index 9fd0ce8..33109d8 100644 --- a/app/views/v1/licenses/_license.json.jbuilder +++ b/app/views/v1/licenses/_license.json.jbuilder @@ -1,4 +1,5 @@ json.id license.id +json.status license.status json.partial! 'v1/licenses/location', location: license.location if license.confidential? json.partial! 'v1/licenses/confidential_well_type', well_type: license.well_type 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 |
