summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-02-22 00:27:11 -0700
committermo khan <mo@mokhan.ca>2014-02-22 00:27:11 -0700
commitc76e1f97aec3c59cd5e3563e660bbb8905e64136 (patch)
tree3cedc47880069a31cc72cf05de3a6a4141fc11d6 /spec/views
parent3db1f24191ff0a5c1638b5f89e1f0ed595185cd8 (diff)
start view specs for each json response.
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/v1/licenses/index.json.jbuilder_spec.rb17
-rw-r--r--spec/views/v1/licenses/show.json.jbuilder_spec.rb17
2 files changed, 34 insertions, 0 deletions
diff --git a/spec/views/v1/licenses/index.json.jbuilder_spec.rb b/spec/views/v1/licenses/index.json.jbuilder_spec.rb
new file mode 100644
index 0000000..d2583a3
--- /dev/null
+++ b/spec/views/v1/licenses/index.json.jbuilder_spec.rb
@@ -0,0 +1,17 @@
+require "spec_helper"
+
+describe 'v1/licenses/index' do
+ let!(:license) { License.create(issued_at: 2.days.ago, expired_at: 1.day.from_now) }
+
+ before :each do
+ assign(:licenses, License.all)
+ 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
diff --git a/spec/views/v1/licenses/show.json.jbuilder_spec.rb b/spec/views/v1/licenses/show.json.jbuilder_spec.rb
new file mode 100644
index 0000000..e4b337c
--- /dev/null
+++ b/spec/views/v1/licenses/show.json.jbuilder_spec.rb
@@ -0,0 +1,17 @@
+require "spec_helper"
+
+describe 'v1/licenses/show' do
+ let!(:license) { License.create(issued_at: 2.days.ago, expired_at: 1.day.from_now) }
+
+ before :each do
+ assign(:license, license)
+ render
+ end
+
+ let(:result) { JSON.parse(rendered) }
+
+ it "includes the license date range" do
+ result["issued_at"].should == license.issued_at.to_s
+ result["expired_at"].should == license.expired_at.to_s
+ end
+end