Commit 71e31d89d12eac06449af696f83d7d13a238f9f8
Committed by
Rafael Manzo
1 parent
6e10cd8a
Exists in
colab
and in
4 other branches
Readings route
Signed-off By: Fellipe Souto Sampaio <fllsouto@gmail.com>
Showing
3 changed files
with
30 additions
and
1 deletions
Show diff stats
config/routes.rb
| @@ -12,7 +12,9 @@ Mezuro::Application.routes.draw do | @@ -12,7 +12,9 @@ Mezuro::Application.routes.draw do | ||
| 12 | get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process | 12 | get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | - resources :reading_groups | 15 | + resources :reading_groups do |
| 16 | + resources :readings | ||
| 17 | + end | ||
| 16 | 18 | ||
| 17 | #resources :modules | 19 | #resources :modules |
| 18 | get '/modules/:id/metric_history' => 'modules#metric_history' | 20 | get '/modules/:id/metric_history' => 'modules#metric_history' |
| @@ -0,0 +1,20 @@ | @@ -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 |