diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-22 08:16:49 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-22 08:16:49 -0700 |
| commit | ba07bb7f1ea83845cfd8e0fdae5f860087147b5c (patch) | |
| tree | c8ddf3812070344859ec7805d10a826819f19190 | |
| parent | 50bd8659e26cebb8c729b25f09eef7e3a25111c5 (diff) | |
add license statuses to the json response.
| -rw-r--r-- | app/views/v1/licenses/index.jbuilder | 5 | ||||
| -rw-r--r-- | spec/views/v1/licenses/index.json.jbuilder_spec.rb | 9 |
2 files changed, 14 insertions, 0 deletions
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 |
