Commit 14d4e99b07494a51c46e2554f5a43d7514c008e3

Authored by Rafael Manzo
Committed by Paulo Meireles
1 parent dbad21b2

Repository state route

Signed-off-by: Carlos Morais <carlos88morais@gmail.com>
app/controllers/repositories_controller.rb
... ... @@ -62,6 +62,9 @@ class RepositoriesController &lt; ApplicationController
62 62 end
63 63 end
64 64  
  65 + # GET /projects/1/repositories/1/state
  66 + def state ; end
  67 +
65 68 private
66 69 # Duplicated code on create and update actions extracted here
67 70 def failed_action(format, destiny_action)
... ...
config/routes.rb
... ... @@ -7,6 +7,7 @@ Mezuro::Application.routes.draw do
7 7 resources :projects do
8 8 resources :repositories, except: [:update, :index]
9 9 get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module
  10 + get '/repositories/:id/state' => 'repositories#state', as: :repository_state
10 11 put '/repositories/:id' => 'repositories#update', as: :repository_update
11 12 end
12 13  
... ...
spec/routing/repositories_routing_spec.rb
... ... @@ -18,5 +18,7 @@ describe RepositoriesController do
18 18 to(controller: :repositories, action: :update, project_id: 1, id: 1) }
19 19 it { should_not route(:get, '/projects/1/repositories').
20 20 to(controller: :repositories, action: :index, project_id: 1) }
  21 + it { should route(:get, '/projects/1/repositories/1/state').
  22 + to(controller: :repositories, action: :state, project_id: 1, id: 1) }
21 23 end
22 24 end
... ...