blob: 412f6fba3af94d03ed3ded919aa47a22d84cba8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require "spec_helper"
describe 'v1/licenses/index' do
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(:licenses, [license])
render
puts rendered
end
let(:result) { JSON.parse(rendered) }
it "includes the license date range" do
result.first["id"].should == license.id
result.first["company"]["name"].should == license.company.name
result.first["well_type"]["id"].should == well_type.id
result.first["well_type"]["acronym"].should == well_type.acronym
result.first["well_type"]["name"].should == well_type.name
result.first["location"]["latitude"].should == location.latitude
result.first["location"]["longitude"].should == location.longitude
result.first["location"]["township"].should == location.township
result.first["issued_at"].should == license.issued_at.to_s
result.first["expired_at"].should == license.expired_at.to_s
end
end
|