From db99ef65b0cb026d8fefae9dac24f8648bc8afd6 Mon Sep 17 00:00:00 2001 From: Renan Fichberg Date: Tue, 11 Feb 2014 12:07:16 -0200 Subject: [PATCH] Routes & its unit test for ranges --- app/controllers/mezuro_ranges_controller.rb | 26 ++++++++++++++++++++++++++ config/routes.rb | 6 +++++- spec/routing/mezuro_ranges_routing_spec.rb | 20 ++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 app/controllers/mezuro_ranges_controller.rb create mode 100644 spec/routing/mezuro_ranges_routing_spec.rb diff --git a/app/controllers/mezuro_ranges_controller.rb b/app/controllers/mezuro_ranges_controller.rb new file mode 100644 index 0000000..000aa5a --- /dev/null +++ b/app/controllers/mezuro_ranges_controller.rb @@ -0,0 +1,26 @@ +include OwnershipAuthentication + +class MezuroRangesController < ApplicationController + +def show +end + +def create +end + +def destroy +end + +def update +end + +def index +end + +def edit +end + +def new +end + +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c041a07..6059d63 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,11 @@ Mezuro::Application.routes.draw do resources :mezuro_configurations do get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric - resources :metric_configurations, except: [:update, :new] + resources :metric_configurations, except: [:update, :new] do + get '/mezuro_ranges/new' => 'mezuro_ranges#new', as: :new_mezuro_range + resources :mezuro_ranges, except: [:update, :new] + put '/mezuro_ranges/:id' => 'mezuro_ranges#update', as: :mezuro_range_update + end get '/metric_configurations/:metric_name/:base_tool_name/new' => 'metric_configurations#new', as: :new_metric_configuration put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update diff --git a/spec/routing/mezuro_ranges_routing_spec.rb b/spec/routing/mezuro_ranges_routing_spec.rb new file mode 100644 index 0000000..6b605c2 --- /dev/null +++ b/spec/routing/mezuro_ranges_routing_spec.rb @@ -0,0 +1,20 @@ +require "spec_helper" + +describe MezuroRangesController do + describe "routing" do + it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). + to(controller: :mezuro_ranges, action: :index, mezuro_configuration_id: "1", metric_configuration_id: "1") } + it { should route(:post, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges'). + to(controller: :mezuro_ranges, action: :create, mezuro_configuration_id: "1", metric_configuration_id: "1") } + it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1/edit'). + to(controller: :mezuro_ranges, action: :edit, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } + it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + to(controller: :mezuro_ranges, action: :show, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } + it { should route(:delete, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + to(controller: :mezuro_ranges, action: :destroy, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } + it { should route(:get, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/new'). + to(controller: :mezuro_ranges, action: :new, mezuro_configuration_id: "1", metric_configuration_id: "1") } + it { should route(:put, '/mezuro_configurations/1/metric_configurations/1/mezuro_ranges/1'). + to(controller: :mezuro_ranges, action: :update, mezuro_configuration_id: "1", metric_configuration_id: "1", id: "1") } + end +end -- libgit2 0.21.2