From 8fa71f5e5200c91ab3916154a9b00e75c4064a2f Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 20 Feb 2014 20:11:50 -0700 Subject: add routes to companies/:company_id/licenses --- app/controllers/v1/company_licenses_controller.rb | 2 ++ config/routes.rb | 3 +++ spec/routing/company_licenses_routing_spec.rb | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 app/controllers/v1/company_licenses_controller.rb create mode 100644 spec/routing/company_licenses_routing_spec.rb diff --git a/app/controllers/v1/company_licenses_controller.rb b/app/controllers/v1/company_licenses_controller.rb new file mode 100644 index 0000000..aa52b26 --- /dev/null +++ b/app/controllers/v1/company_licenses_controller.rb @@ -0,0 +1,2 @@ +class V1::CompanyLicensesController +end diff --git a/config/routes.rb b/config/routes.rb index a9b6923..b61e488 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,8 @@ CodeChallengeMo::Application.routes.draw do namespace :v1, path: 'v1' do resources :licenses, only: [:index, :show] + resources :companies, only: [] do + resources :licenses, controller: 'company_licenses', only: [:index] + end end end diff --git a/spec/routing/company_licenses_routing_spec.rb b/spec/routing/company_licenses_routing_spec.rb new file mode 100644 index 0000000..d6e5aa4 --- /dev/null +++ b/spec/routing/company_licenses_routing_spec.rb @@ -0,0 +1,8 @@ +require "spec_helper" + +describe 'v1/companies/:id/licenses' do + it "routes to the index action" do + company_id = SecureRandom.uuid + expect(get: "v1/companies/#{company_id}/licenses").to route_to(controller: 'v1/company_licenses', action: 'index', company_id: company_id) + end +end -- cgit v1.2.3