From 85009727fccd91a27c658993417ca2d3b50c2364 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 07:31:20 -0700 Subject: add json response for licenses#show. --- spec/views/v1/licenses/show.json.jbuilder_spec.rb | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (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 e4b337c..dff07fa 100644 --- a/spec/views/v1/licenses/show.json.jbuilder_spec.rb +++ b/spec/views/v1/licenses/show.json.jbuilder_spec.rb @@ -1,7 +1,11 @@ require "spec_helper" describe 'v1/licenses/show' do - let!(:license) { License.create(issued_at: 2.days.ago, expired_at: 1.day.from_now) } + let(:company) { Company.new(name: 'ABC Resources Ltd.') } + let(:user) { User.new(company: company) } + let(:location) { Location.new(latitude: 51.06, longitude: -114.09, township: '1') } + let(:well_type) { WellType::DEV } + let(: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 assign(:license, license) @@ -14,4 +18,24 @@ describe 'v1/licenses/show' do result["issued_at"].should == license.issued_at.to_s result["expired_at"].should == license.expired_at.to_s end + + it "includes the license id" do + result["id"].should == license.id + end + + it "includes the company information" do + result["company"]["name"].should == license.company.name + end + + it "includes information on the type of well" do + result["well_type"]["id"].should == well_type.id + result["well_type"]["acronym"].should == well_type.acronym + result["well_type"]["name"].should == well_type.name + end + + it "includes location information" do + result["location"]["latitude"].should == location.latitude + result["location"]["longitude"].should == location.longitude + result["location"]["township"].should == location.township + end end -- cgit v1.2.3