diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-22 07:18:53 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-22 07:18:53 -0700 |
| commit | 1b5f09e0fa8049e68053ad8c20e0c602460a0dc5 (patch) | |
| tree | 987a2089517363d2a89234dcd0bc48c1c12d187f /spec/views/v1 | |
| parent | 2dd2a09d8c9f939639e72c62ecd4367f7a3ec059 (diff) | |
add id to json response.
Diffstat (limited to 'spec/views/v1')
| -rw-r--r-- | spec/views/v1/licenses/index.json.jbuilder_spec.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/views/v1/licenses/index.json.jbuilder_spec.rb b/spec/views/v1/licenses/index.json.jbuilder_spec.rb index 38d9955..412f6fb 100644 --- a/spec/views/v1/licenses/index.json.jbuilder_spec.rb +++ b/spec/views/v1/licenses/index.json.jbuilder_spec.rb @@ -5,24 +5,26 @@ describe 'v1/licenses/index' do 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(company: company, applicant: user, location: location, issued_at: 2.days.ago, expired_at: 1.day.from_now, well_type: well_type) } + 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["issued_at"].should == license.issued_at.to_s - result.first["expired_at"].should == license.expired_at.to_s + 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["company"]["name"].should == license.company.name + result.first["issued_at"].should == license.issued_at.to_s + result.first["expired_at"].should == license.expired_at.to_s end end |
