diff options
| -rw-r--r-- | app/controllers/v1/company_licenses_controller.rb | 1 | ||||
| -rw-r--r-- | app/views/v1/company_licenses/index.jbuilder (renamed from app/views/v1/company_licenses/index.json.jbuilder) | 0 | ||||
| -rw-r--r-- | spec/controllers/v1/company_licenses_controller_spec.rb | 11 |
3 files changed, 3 insertions, 9 deletions
diff --git a/app/controllers/v1/company_licenses_controller.rb b/app/controllers/v1/company_licenses_controller.rb index 3b4850f..6f2f666 100644 --- a/app/controllers/v1/company_licenses_controller.rb +++ b/app/controllers/v1/company_licenses_controller.rb @@ -3,7 +3,6 @@ class V1::CompanyLicensesController < ApplicationController def index @active_licenses = @company.filter_licenses_using(search_filters) - render json: @active_licenses end private diff --git a/app/views/v1/company_licenses/index.json.jbuilder b/app/views/v1/company_licenses/index.jbuilder index 8228f3e..8228f3e 100644 --- a/app/views/v1/company_licenses/index.json.jbuilder +++ b/app/views/v1/company_licenses/index.jbuilder diff --git a/spec/controllers/v1/company_licenses_controller_spec.rb b/spec/controllers/v1/company_licenses_controller_spec.rb index e811179..c6f34c9 100644 --- a/spec/controllers/v1/company_licenses_controller_spec.rb +++ b/spec/controllers/v1/company_licenses_controller_spec.rb @@ -14,18 +14,13 @@ describe V1::CompanyLicensesController do it "returns the active licenses" do company.stub(:filter_licenses_using).with({status: LicenseStatus::ACTIVE, township: nil}).and_return(active_licenses) - xhr :get, :index, company_id: company_id + get :index, company_id: company_id assigns(:active_licenses).should == active_licenses end - it "returns a json response" do - xhr :get, :index, company_id: company_id - expect(-> { JSON.parse(response.body) }).not_to raise_error - end - it "returns the active licenses for a given township" do company.stub(:filter_licenses_using).with({status: LicenseStatus::ACTIVE, township: "123"}).and_return(active_licenses_in_township) - xhr :get, :index, company_id: company_id, township: "123" + get :index, company_id: company_id, township: "123" assigns(:active_licenses).should == active_licenses_in_township end end @@ -37,7 +32,7 @@ describe V1::CompanyLicensesController do let!(:license) { company.licenses.create(well_type: WellType::DEV, location: location, issued_at: 2.days.ago, expired_at: 1.day.ago) } it "finds expired licenses from a specific township" do - xhr :get, :index, company_id: company.id, status: "expired", township: "1" + get :index, company_id: company.id, status: "expired", township: "1" assigns(:active_licenses).should include(license) end end |
