From c76e1f97aec3c59cd5e3563e660bbb8905e64136 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 00:27:11 -0700 Subject: start view specs for each json response. --- spec/views/v1/licenses/index.json.jbuilder_spec.rb | 17 +++++++++++++++++ spec/views/v1/licenses/show.json.jbuilder_spec.rb | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 spec/views/v1/licenses/index.json.jbuilder_spec.rb create mode 100644 spec/views/v1/licenses/show.json.jbuilder_spec.rb (limited to 'spec/views/v1') 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 -- cgit v1.2.3