diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-21 21:54:15 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-21 21:54:15 -0700 |
| commit | 476bee1ff1e1c0d4fe553898f5f029530a41919c (patch) | |
| tree | 70e3d78c2f6ab0b7f2f10be274f202091014430a | |
| parent | fe13da4831bade3b7292d5143ab7267edd4a63df (diff) | |
start to build the json specs.
| -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 |
