From ba07bb7f1ea83845cfd8e0fdae5f860087147b5c Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 22 Feb 2014 08:16:49 -0700 Subject: add license statuses to the json response. --- app/views/v1/licenses/index.jbuilder | 5 +++++ spec/views/v1/licenses/index.json.jbuilder_spec.rb | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/app/views/v1/licenses/index.jbuilder b/app/views/v1/licenses/index.jbuilder index 2f31916..f8125e5 100644 --- a/app/views/v1/licenses/index.jbuilder +++ b/app/views/v1/licenses/index.jbuilder @@ -10,3 +10,8 @@ json.well_types do json.name well_type.name end end +json.license_statuses do + json.array! @license_statuses do |status| + json.name status.to_s + end +end diff --git a/spec/views/v1/licenses/index.json.jbuilder_spec.rb b/spec/views/v1/licenses/index.json.jbuilder_spec.rb index f88ecc5..297f2af 100644 --- a/spec/views/v1/licenses/index.json.jbuilder_spec.rb +++ b/spec/views/v1/licenses/index.json.jbuilder_spec.rb @@ -10,6 +10,7 @@ describe 'v1/licenses/index' do before :each do assign(:licenses, [license]) assign(:well_types, WellType::ALL) + assign(:license_statuses, LicenseStatus::ALL) render end @@ -47,4 +48,12 @@ describe 'v1/licenses/index' do row['name'].should == well_type.name end end + + it "includes all the license statuses" do + puts rendered + LicenseStatus::ALL.each do |status| + row = result["license_statuses"].find { |x| x['name'] == status.to_s } + row.should_not be_nil + end + end end -- cgit v1.2.3