diff options
| -rw-r--r-- | app/views/v1/company_licenses/index.jbuilder | 9 | ||||
| -rw-r--r-- | spec/views/v1/company_licenses/index.json.jbuilder_spec.rb | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/app/views/v1/company_licenses/index.jbuilder b/app/views/v1/company_licenses/index.jbuilder new file mode 100644 index 0000000..ff31792 --- /dev/null +++ b/app/views/v1/company_licenses/index.jbuilder @@ -0,0 +1,9 @@ +json.array! @licenses do |license| + json.issued_at license.issued_at.to_s + json.expired_at license.expired_at.to_s + json.well_type do + json.id 1 + json.pneumonic "NFW" + json.name "New Field Wildcat" + end +end diff --git a/spec/views/v1/company_licenses/index.json.jbuilder_spec.rb b/spec/views/v1/company_licenses/index.json.jbuilder_spec.rb new file mode 100644 index 0000000..52b5fe5 --- /dev/null +++ b/spec/views/v1/company_licenses/index.json.jbuilder_spec.rb @@ -0,0 +1,18 @@ +require "spec_helper" + +describe 'v1/company_licenses/index' do + let!(:company) { Company.create(name: 'acme') } + let!(:license) { company.licenses.create(issued_at: 2.days.ago, expired_at: 1.day.from_now) } + + before :each do + assign(:licenses, company.licenses) + render + 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 + end +end |
