summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-22 07:31:20 -0700
committermo khan <mo@mokhan.ca>2014-02-22 07:31:20 -0700
commit85009727fccd91a27c658993417ca2d3b50c2364 (patch)
treea7d9b2d21d23d54770cd78c027699eea43af133d /spec
parent10d812064f745c4d11eeba91daf3376e608f0c6f (diff)
add json response for licenses#show.
Diffstat (limited to 'spec')
-rw-r--r--spec/views/v1/licenses/show.json.jbuilder_spec.rb26
1 files changed, 25 insertions, 1 deletions
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