Commit 108b8cece3605c40ba7fedbb4089d1c1eba07ac1

Authored by Guilherme Rojas V. de Lima
Committed by Rafael Manzo
1 parent 8c234ac7

Routing to create new compound metric

signed-off-by: Diego Araújo <diegoamc90@gmail.com>
app/views/metric_configurations/choose_metric.html.erb
@@ -11,7 +11,9 @@ @@ -11,7 +11,9 @@
11 <% end %> 11 <% end %>
12 </div> 12 </div>
13 <% end %> 13 <% end %>
14 -</div> 14 +</div><br />
  15 +
  16 +<%= link_to 'Compound Metric', mezuro_configuration_new_compound_metric_path(@mezuro_configuration_id), class: 'btn btn-default' %>
15 17
16 <script type="text/javascript"> 18 <script type="text/javascript">
17 //Loads the accordion 19 //Loads the accordion
config/routes.rb
@@ -12,6 +12,7 @@ Mezuro::Application.routes.draw do @@ -12,6 +12,7 @@ Mezuro::Application.routes.draw do
12 12
13 resources :mezuro_configurations do 13 resources :mezuro_configurations do
14 get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric 14 get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric
  15 + get '/new_compound_metric' => 'metric_configurations#new_compound_metric', as: :new_compound_metric
15 resources :metric_configurations, except: [:update, :new] 16 resources :metric_configurations, except: [:update, :new]
16 get '/metric_configurations/:metric_name/:base_tool_name/new' => 'metric_configurations#new', as: :new_metric_configuration 17 get '/metric_configurations/:metric_name/:base_tool_name/new' => 'metric_configurations#new', as: :new_metric_configuration
17 put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update 18 put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update
spec/routing/metric_configurations_routing_spec.rb
@@ -6,6 +6,8 @@ describe MetricConfigurationsController do @@ -6,6 +6,8 @@ describe MetricConfigurationsController do
6 to(controller: :metric_configurations, action: :new, mezuro_configuration_id: "1", metric_name: "LOC", base_tool_name: "Analizo") } 6 to(controller: :metric_configurations, action: :new, mezuro_configuration_id: "1", metric_name: "LOC", base_tool_name: "Analizo") }
7 it { should route(:get, '/mezuro_configurations/1/metric_configurations'). 7 it { should route(:get, '/mezuro_configurations/1/metric_configurations').
8 to(controller: :metric_configurations, action: :index, mezuro_configuration_id: "1") } 8 to(controller: :metric_configurations, action: :index, mezuro_configuration_id: "1") }
  9 + it { should route(:get, '/mezuro_configurations/1/new_compound_metric').
  10 + to(controller: :metric_configurations, action: :new_compound_metric, mezuro_configuration_id: "1") }
9 it { should route(:post, '/mezuro_configurations/1/metric_configurations'). 11 it { should route(:post, '/mezuro_configurations/1/metric_configurations').
10 to(controller: :metric_configurations, action: :create, mezuro_configuration_id: "1") } 12 to(controller: :metric_configurations, action: :create, mezuro_configuration_id: "1") }
11 it { should route(:get, '/mezuro_configurations/1/metric_configurations/1'). 13 it { should route(:get, '/mezuro_configurations/1/metric_configurations/1').