Commit 71e31d89d12eac06449af696f83d7d13a238f9f8

Authored by Guilherme Rojas V. de Lima
Committed by Rafael Manzo
1 parent 6e10cd8a

Readings route

Signed-off By: Fellipe Souto Sampaio <fllsouto@gmail.com>
app/controllers/readings_controller.rb 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +include OwnershipAuthentication
  2 +
  3 +class ReadingsController < ApplicationController
  4 + before_action :authenticate_user!, except: [:show]
  5 + # before_action :reading_group_owner?, except: [:show]
  6 +
  7 +end
... ...
config/routes.rb
... ... @@ -12,7 +12,9 @@ Mezuro::Application.routes.draw do
12 12 get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process
13 13 end
14 14  
15   - resources :reading_groups
  15 + resources :reading_groups do
  16 + resources :readings
  17 + end
16 18  
17 19 #resources :modules
18 20 get '/modules/:id/metric_history' => 'modules#metric_history'
... ...
spec/routing/readings_routing_spec.rb 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +require "spec_helper"
  2 +
  3 +describe ReadingsController do
  4 + describe "routing" do
  5 + it { should route(:post, '/reading_groups/1/readings').
  6 + to(controller: :readings, action: :create, reading_group_id: 1) }
  7 + it { should route(:get, '/reading_groups/1/readings/new').
  8 + to(controller: :readings, action: :new, reading_group_id: 1) }
  9 + it { should route(:get, '/reading_groups/1/readings/1/edit').
  10 + to(controller: :readings, action: :edit, reading_group_id: 1, id: 1) }
  11 + it { should route(:get, '/reading_groups/1/readings/1').
  12 + to(controller: :readings, action: :show, reading_group_id: 1, id: 1) }
  13 + it { should route(:delete, '/reading_groups/1/readings/1').
  14 + to(controller: :readings, action: :destroy, reading_group_id: 1, id: 1) }
  15 + it { should route(:put, '/reading_groups/1/readings/1').
  16 + to(controller: :readings, action: :update, reading_group_id: 1, id: 1) }
  17 + it { should route(:get, '/reading_groups/1/readings').
  18 + to(controller: :readings, action: :index, reading_group_id: 1) }
  19 + end
  20 +end
... ...