Commit 76666012b15c08a7a827fb7ab719d1e08180bc3a

Authored by Rafael Manzo
2 parents 93df8ac0 34166559

Merge pull request #233 from mezuro/decouple_repository_project

Decouple repository project
app/assets/javascripts/repository/state.js.coffee
1 1 class Repository.State
2   - constructor: (@project_id, @repository_id) ->
  2 + constructor: (@repository_id) ->
3 3  
4 4 poll_state: (last_state) ->
5   - $.post('/projects/' + @project_id + '/repositories/' + @repository_id + '/state',
  5 + $.post('/repositories/' + @repository_id + '/state',
6 6 last_state: last_state)
7 7  
8 8 schedule_poll_state: (last_state) ->
... ...
app/controllers/concerns/ownership_authentication.rb
... ... @@ -14,7 +14,7 @@ module OwnershipAuthentication
14 14 end
15 15  
16 16 def repository_owner?
17   - check_project_ownership(params[:project_id])
  17 + check_repository_ownership(params[:id])
18 18 end
19 19  
20 20 def reading_group_owner?
... ... @@ -48,9 +48,20 @@ module OwnershipAuthentication
48 48 check_kalibro_configuration_ownership(params[:kalibro_configuration_id])
49 49 end
50 50  
51   -
52 51 private
53 52  
  53 + def check_repository_ownership(id)
  54 + if current_user.repository_attributes.find_by_repository_id(id).nil?
  55 + respond_to do |format|
  56 + format.html { redirect_to projects_url, notice: t('not_allowed') }
  57 + format.json { head :no_content }
  58 + end
  59 + end
  60 +
  61 + return true
  62 + end
  63 +
  64 +
54 65 def check_project_ownership(id)
55 66 if current_user.project_attributes.find_by_project_id(id).nil?
56 67 respond_to do |format|
... ...
app/controllers/repositories_controller.rb
... ... @@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController
38 38 def update
39 39 respond_to do |format|
40 40 if @repository.update(repository_params)
41   - format.html { redirect_to(project_repository_path(params[:project_id], @repository.id), notice: t('successfully_updated', :record => t(@repository.class))) }
  41 + format.html { redirect_to(repository_path(@repository.id), notice: t('successfully_updated', :record => t(@repository.class))) }
42 42 format.json { head :no_content }
43 43 else
44 44 failed_action(format, 'edit')
... ... @@ -51,7 +51,7 @@ class RepositoriesController < ApplicationController
51 51 def destroy
52 52 @repository.destroy
53 53 respond_to do |format|
54   - format.html { redirect_to project_path(params[:project_id]) }
  54 + format.html { redirect_to projects_path }
55 55 format.json { head :no_content }
56 56 end
57 57 end
... ... @@ -80,7 +80,7 @@ class RepositoriesController < ApplicationController
80 80 @repository.process
81 81 set_kalibro_configuration
82 82 respond_to do |format|
83   - format.html { redirect_to project_repository_path(@repository.project_id, @repository.id) }
  83 + format.html { redirect_to repository_path(@repository.id) }
84 84 end
85 85 end
86 86  
... ... @@ -135,7 +135,8 @@ private
135 135 # Code extracted from create action
136 136 def create_and_redir(format)
137 137 if @repository.save
138   - format.html { redirect_to project_repository_process_path(@repository.project_id, @repository.id), notice: t('successfully_created', :record => t(@repository.class)) }
  138 + current_user.repository_attributes.create(repository_id: @repository.id)
  139 + format.html { redirect_to repository_process_path(@repository.id), notice: t('successfully_created', :record => t(@repository.class)) }
139 140 else
140 141 failed_action(format, 'new')
141 142 end
... ...
app/models/repository_attributes.rb 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +class RepositoryAttributes < ActiveRecord::Base
  2 + belongs_to :user
  3 + validates :repository_id, presence: true
  4 + validates :user, presence: true
  5 +
  6 + def repository
  7 + @repository ||= Repository.find(repository_id)
  8 + end
  9 +
  10 + def repository=(repository)
  11 + @repository = repository
  12 + self.repository_id = @repository ? @repository.id : nil
  13 + end
  14 +end
... ...
app/models/user.rb
... ... @@ -10,6 +10,7 @@ class User &lt; ActiveRecord::Base
10 10  
11 11 has_many :project_attributes, class_name: 'ProjectAttributes'
12 12 has_many :reading_group_attributes, class_name: 'ReadingGroupAttributes'
  13 + has_many :repository_attributes, class_name: 'RepositoryAttributes'
13 14 has_many :kalibro_configuration_attributes, class_name: 'KalibroConfigurationAttributes'
14 15 # Alert: when adding new parameters to this model, they should also be added to registrations_controller
15 16  
... ...
app/views/projects/show.html.erb
... ... @@ -44,11 +44,11 @@
44 44 <td><%= repository.address %></td>
45 45 <td>
46 46 <% if project_owner? @project.id %>
47   - <%= link_to t('edit'), edit_project_repository_path(@project, repository.id), class: 'btn btn-info' %>
  47 + <%= link_to t('edit'), edit_repository_path(repository.id), class: 'btn btn-info' %>
48 48 <% end %>
49 49 </td>
50 50 <td>
51   - <%= link_to t('show'), project_repository_path(@project, repository.id), class: 'btn btn-info' %></td>
  51 + <%= link_to t('show'), repository_path(repository.id), class: 'btn btn-info' %></td>
52 52 </td>
53 53 </tr>
54 54 <% end %>
... ...
app/views/repositories/_form.html.erb
... ... @@ -106,7 +106,7 @@
106 106 </div>
107 107 <div class="row margin-left-none" style="margin-top: 20px">
108 108 <%= f.submit t('save'), class: 'btn btn-primary' %>
109   - <%= link_to t('back'), project_path(@project_id), class: 'btn btn-default' %>
  109 + <%= link_to t('back'), projects_path, class: 'btn btn-default' %>
110 110 </div>
111 111  
112 112 <script type="text/javascript">
... ...
app/views/repositories/edit.html.erb
... ... @@ -2,6 +2,6 @@
2 2 <h1><%= t_action(:edit, Repository) %></h1>
3 3 </div>
4 4  
5   -<%= form_for(@repository, :url => project_repository_update_url(@project_id, @repository.id), method: :put) do |f| %>
  5 +<%= form_for(@repository, :url => repository_update_url(@repository.id), method: :put) do |f| %>
6 6 <%= render partial: 'form', locals: {f: f} %>
7 7 <% end %>
... ...
app/views/repositories/reload_processing.js.erb
1 1 current_path_splited = window.location.pathname.split("/");
2   -if(current_path_splited[1] != "projects"){
  2 +if(current_path_splited[1] != "repositories"){
3 3 current_path_splited.splice(1,1); // Removes the locale
4 4 }
5 5 current_path = current_path_splited.join("/");
6 6  
7 7 // This if prevents it from updating the repository's state after the user leaves its page
8   -if(current_path == '<%= project_repository_path(project_id: @repository.project_id, id: @repository, locale: nil) %>'){
  8 +if(current_path == '<%= repository_path(id: @repository, locale: nil) %>'){
9 9 $('div#processing_information').html('<%= escape_javascript(render partial: "processing_information") %>');
10   - repository = new Repository.State(<%= @repository.project_id %>, <%= @repository.id %>)
  10 + repository = new Repository.State(<%= @repository.id %>)
11 11 repository.schedule_poll_state('<%= @processing.state %>')
12 12 }
... ...
app/views/repositories/show.html.erb
... ... @@ -39,7 +39,7 @@
39 39  
40 40 <p><strong> <%= t('repository.show.date_processing') %>: </strong></p>
41 41  
42   -<%= form_tag(project_repository_state_with_date_path(@repository.project_id, @repository.id), method: "post", remote: true) do %>
  42 +<%= form_tag(repository_state_with_date_path(@repository.id), method: "post", remote: true) do %>
43 43 <p>
44 44 <%= label_tag :day, t("day") %>:
45 45 <%= select_tag(:day, options_for_select(day_options), :style => "width:55px; margin-top:5px") %>
... ... @@ -71,7 +71,7 @@
71 71 </div>
72 72 <script type="text/javascript">
73 73 $(document).ready(function () {
74   - (new Repository.State(<%= @repository.project_id %>, <%= @repository.id %>)).poll_state('')
  74 + (new Repository.State(<%= @repository.id %>)).poll_state('')
75 75 });
76 76  
77 77 //Loads the accordion
... ... @@ -89,6 +89,6 @@
89 89  
90 90 <%= link_to t('back'), project_path(@repository.project_id), class: 'btn btn-default' %>
91 91 <% if project_owner? @repository.project_id %>
92   - <%= link_to t('repository.show.reprocess'), project_repository_process_path(@repository.project_id, @repository.id), class: 'btn btn-info' %>
93   - <%= link_to t('destroy'), project_repository_path(@repository.project_id, @repository.id), method: :delete, data: { confirm: t('sure_destroy', model: Repository.model_name.human) }, class: 'btn btn-danger' %>
  92 + <%= link_to t('repository.show.reprocess'), repository_process_path(@repository.id), class: 'btn btn-info' %>
  93 + <%= link_to t('destroy'), repository_path(@repository.id), method: :delete, data: { confirm: t('sure_destroy', model: Repository.model_name.human) }, class: 'btn btn-danger' %>
94 94 <% end %>
... ...
config/routes.rb
... ... @@ -4,14 +4,16 @@ Rails.application.routes.draw do
4 4 get 'users/:user_id/projects' => 'users#projects', as: :user_projects
5 5  
6 6 resources :projects do
7   - resources :repositories, except: [:update, :index]
8   - get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module
9   - post '/repositories/:id/state' => 'repositories#state', as: :repository_state
10   - post '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date
11   - put '/repositories/:id' => 'repositories#update', as: :repository_update
12   - get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process
  7 + resources :repositories, only: [:new, :create]
13 8 end
14 9  
  10 + resources :repositories, except: [:update, :index]
  11 + get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module
  12 + post '/repositories/:id/state' => 'repositories#state', as: :repository_state
  13 + post '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date
  14 + put '/repositories/:id' => 'repositories#update', as: :repository_update
  15 + get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process
  16 +
15 17 get '/repository_branches' => 'repositories#branches', as: :repository_branches
16 18  
17 19 resources :kalibro_configurations do
... ...
db/migrate/20150616164352_create_repository_attributes.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class CreateRepositoryAttributes < ActiveRecord::Migration
  2 + def change
  3 + create_table :repository_attributes do |t|
  4 + t.integer :repository_id
  5 + t.references :user, index: true, foreign_key: true
  6 +
  7 + t.timestamps null: false
  8 + end
  9 + end
  10 +end
... ...
db/schema.rb
... ... @@ -11,7 +11,7 @@
11 11 #
12 12 # It's strongly recommended that you check this file into your version control system.
13 13  
14   -ActiveRecord::Schema.define(version: 20150515195059) do
  14 +ActiveRecord::Schema.define(version: 20150616164352) do
15 15  
16 16 create_table "kalibro_configuration_attributes", force: :cascade do |t|
17 17 t.integer "user_id"
... ... @@ -38,6 +38,15 @@ ActiveRecord::Schema.define(version: 20150515195059) do
38 38 t.boolean "public", default: true
39 39 end
40 40  
  41 + create_table "repository_attributes", force: :cascade do |t|
  42 + t.integer "repository_id"
  43 + t.integer "user_id"
  44 + t.datetime "created_at", null: false
  45 + t.datetime "updated_at", null: false
  46 + end
  47 +
  48 + add_index "repository_attributes", ["user_id"], name: "index_repository_attributes_on_user_id"
  49 +
41 50 create_table "users", force: :cascade do |t|
42 51 t.string "name", limit: 255, default: "", null: false
43 52 t.string "email", limit: 255, default: "", null: false
... ...
features/repository/delete.feature
... ... @@ -10,8 +10,9 @@ Feature: Project Deletion
10 10 And I own a sample project
11 11 And I have a sample configuration with native metrics
12 12 And I have a sample repository within the sample project named "QtCalculator"
  13 + And I own that repository
13 14 And I start to process that repository
14 15 And I wait up for a ready processing
15 16 When I visit the repository show page
16 17 And I click the Destroy link
17   - Then I should see "There are no Repositories yet!"
18 18 \ No newline at end of file
  19 + Then I should be in the All Projects page
19 20 \ No newline at end of file
... ...
features/repository/edit.feature
... ... @@ -10,6 +10,7 @@ Feature: Repository Edit
10 10 And I own a sample project
11 11 And I have a sample configuration with native metrics
12 12 And I have a sample repository within the sample project named "QtCalculator"
  13 + And I own that repository
13 14 And I am at repository edit page
14 15 Then the field "Name" should be filled with "QtCalculator"
15 16 And the field "Type" should be filled with "GIT"
... ... @@ -32,6 +33,7 @@ Feature: Repository Edit
32 33 And I own a sample project
33 34 And I have a sample configuration with native metrics
34 35 And I have a sample repository within the sample project named "QtCalculator"
  36 + And I own that repository
35 37 And I am at repository edit page
36 38 When I fill the Name field with " "
37 39 And I fill the Address field with " "
... ... @@ -46,7 +48,9 @@ Feature: Repository Edit
46 48 And I own a sample project
47 49 And I have a sample configuration with native metrics
48 50 And I have a sample repository within the sample project named "MedSquare"
  51 + And I own that repository
49 52 And I have a sample repository within the sample project named "QtCalculator"
  53 + And I own that repository
50 54 And I am at repository edit page
51 55 When I fill the Name field with "MedSquare"
52 56 And I press the Save button
... ...
features/repository/show/repository_info.feature
... ... @@ -26,6 +26,7 @@ Feature: Show Repository
26 26 And I own a sample project
27 27 And I have a sample configuration with native metrics
28 28 And I have a sample repository within the sample project named "QtCalculator"
  29 + And I own that repository
29 30 And I start to process that repository
30 31 And I wait up for a ready processing
31 32 When I visit the repository show page
... ...
features/step_definitions/repository_steps.rb
... ... @@ -70,7 +70,7 @@ Given(/^I am at the New Repository page$/) do
70 70 end
71 71  
72 72 Given(/^I am at repository edit page$/) do
73   - visit edit_project_repository_path(project_id: @repository.project_id, id: @repository.id)
  73 + visit edit_repository_path(id: @repository.id)
74 74 end
75 75  
76 76 Given(/^I ask for the last ready processing of the given repository$/) do
... ... @@ -89,6 +89,10 @@ Given(/^I see a sample metric&#39;s name$/) do
89 89 expect(page).to have_content(@metric_results.first.metric_configuration.metric.name)
90 90 end
91 91  
  92 +Given(/^I own that repository$/) do
  93 + FactoryGirl.create(:repository_attributes, {repository_id: @repository.id, user_id: @user.id})
  94 +end
  95 +
92 96 When(/^I click on the sample metric's name$/) do
93 97 find_link(@metric_results.first.metric_configuration.metric.name).trigger('click')
94 98 end
... ... @@ -98,7 +102,7 @@ When(/^I set the select field &quot;(.+)&quot; as &quot;(.+)&quot;$/) do |field, text|
98 102 end
99 103  
100 104 When(/^I visit the repository show page$/) do
101   - visit project_repository_path(project_id: @project.id, id: @repository.id)
  105 + visit repository_path(id: @repository.id)
102 106 end
103 107  
104 108 When(/^I click on the sample child's name$/) do
... ...
spec/controllers/concerns/ownership_authentication_spec.rb
... ... @@ -140,4 +140,53 @@ describe OwnershipAuthentication, type: :controller do
140 140 end
141 141 end
142 142 end
  143 +
  144 + describe 'repository_owner?' do
  145 + let(:repository) { FactoryGirl.build(:repository) }
  146 +
  147 + context 'within RepositoriesController' do
  148 + let! (:repositories_controller) { RepositoriesController.new }
  149 +
  150 + before do
  151 + repositories_controller.params = {}
  152 + repositories_controller.params[:id] = repository.id
  153 + end
  154 +
  155 + context 'with a user logged in' do
  156 + let! (:current_user) { FactoryGirl.build(:user) }
  157 +
  158 + before do
  159 + repositories_controller.expects(:current_user).returns(current_user)
  160 + end
  161 +
  162 + context 'when the user owns the Repository' do
  163 + let!(:repository_attributes) { FactoryGirl.build(:repository_attributes, {user_id: current_user.id, repository_id: repository.id}) }
  164 +
  165 + before do
  166 + repository_attrs = mock('repository_attributes')
  167 + repository_attrs.expects(:find_by_repository_id).with(repository.id).returns(repository_attributes)
  168 + current_user.expects(:repository_attributes).returns(repository_attrs)
  169 + end
  170 +
  171 + it 'should return true' do
  172 + expect(repositories_controller.repository_owner?).to be_truthy
  173 + end
  174 + end
  175 +
  176 + context 'when the user does not own the Repository' do
  177 + before do
  178 + repository_attrs = mock('repository_attributes')
  179 + repository_attrs.expects(:find_by_repository_id).with(repository.id).returns(nil)
  180 + current_user.expects(:repository_attributes).returns(repository_attrs)
  181 + end
  182 +
  183 + it 'should respond' do # FIXME: this is not the best test, but it it's the closest we can do I think
  184 + repositories_controller.expects(:respond_to)
  185 +
  186 + repositories_controller.repository_owner?
  187 + end
  188 + end
  189 + end
  190 + end
  191 + end
143 192 end
... ...
spec/controllers/repositories_controller_spec.rb
... ... @@ -65,7 +65,7 @@ describe RepositoriesController, :type =&gt; :controller do
65 65 post :create, project_id: project.id, repository: repository_params
66 66 end
67 67  
68   - it { is_expected.to redirect_to(project_repository_process_path(project_id: repository.project_id, id: repository.id)) }
  68 + it { is_expected.to redirect_to(repository_process_path(id: repository.id)) }
69 69 it { is_expected.to respond_with(:redirect) }
70 70 end
71 71  
... ... @@ -136,7 +136,7 @@ describe RepositoriesController, :type =&gt; :controller do
136 136 delete :destroy, id: repository.id, project_id: project.id.to_s
137 137 end
138 138  
139   - it { is_expected.to redirect_to(project_path(repository.project_id)) }
  139 + it { is_expected.to redirect_to(projects_path) }
140 140 it { is_expected.to respond_with(:redirect) }
141 141 end
142 142  
... ... @@ -226,7 +226,7 @@ describe RepositoriesController, :type =&gt; :controller do
226 226 post :update, project_id: project.id.to_s, id: repository.id, repository: repository_params
227 227 end
228 228  
229   - it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) }
  229 + it { is_expected.to redirect_to(repository_path(repository.id)) }
230 230 it { is_expected.to respond_with(:redirect) }
231 231 end
232 232  
... ... @@ -345,7 +345,7 @@ describe RepositoriesController, :type =&gt; :controller do
345 345 KalibroConfiguration.expects(:find).with(repository.id).returns(FactoryGirl.build(:kalibro_configuration, :with_id))
346 346 get :process_repository, project_id: project.id.to_s, id: repository.id
347 347 end
348   - it { is_expected.to redirect_to(project_repository_path(repository.project_id, repository.id)) }
  348 + it { is_expected.to redirect_to(repository_path(repository.id)) }
349 349 end
350 350  
351 351 describe 'branches' do
... ...
spec/factories/repositories.rb
... ... @@ -23,7 +23,6 @@ FactoryGirl.define do
23 23 scm_type "GIT"
24 24 address "https://github.com/rafamanzo/runge-kutta-vtk.git"
25 25 kalibro_configuration_id 1
26   - project_id 1
27 26 send_email "test@test.com"
28 27 end
29 28  
... ... @@ -36,11 +35,14 @@ FactoryGirl.define do
36 35 scm_type "GIT"
37 36 address "https://github.com/mezuro/kalibro_processor.git"
38 37 kalibro_configuration_id 1
39   - project_id 1
40 38 send_email "test@test.com"
41 39 end
42 40  
43 41 factory :another_repository, parent: :repository do
44 42 id 2
45 43 end
  44 +
  45 + trait :with_project_id do
  46 + project_id 1
  47 + end
46 48 end
... ...
spec/factories/repository_attributes.rb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +FactoryGirl.define do
  2 + factory :repository_attributes do
  3 + association :user, strategy: :build
  4 + association :repository, strategy: :build
  5 + end
  6 +end
... ...
spec/models/repository_attributes_spec.rb 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +require 'rails_helper'
  2 +
  3 +RSpec.describe RepositoryAttributes, type: :model do
  4 + context 'validations' do
  5 + it { is_expected.to validate_presence_of(:repository_id) }
  6 + it { is_expected.to validate_presence_of(:user) }
  7 + end
  8 +
  9 + describe 'associations' do
  10 + it { is_expected.to belong_to(:user) }
  11 + end
  12 +
  13 + describe 'methods' do
  14 + describe 'repository' do
  15 + subject { FactoryGirl.build(:repository_attributes, repository: nil) }
  16 + let(:repository) { FactoryGirl.build(:repository) }
  17 +
  18 + before :each do
  19 + Repository.expects(:find).with(subject.repository_id).returns(repository)
  20 + end
  21 +
  22 + it 'should return the repository' do
  23 + expect(subject.repository).to eq(repository)
  24 + end
  25 + end
  26 +
  27 + describe 'repository=' do
  28 + subject { FactoryGirl.build(:repository_attributes) }
  29 + let(:repository) { FactoryGirl.build(:repository) }
  30 +
  31 + context 'when the repository is not nil' do
  32 + it "should set the repository and it's ID correctly" do
  33 + subject.repository = repository
  34 + expect(subject.repository).to eq(repository)
  35 + expect(subject.repository_id).to eq(repository.id)
  36 + end
  37 + end
  38 +
  39 + context 'when the repository is nil' do
  40 + it "should unset the repository id" do
  41 + subject.repository = nil
  42 + expect(subject.repository_id).to be_nil
  43 + end
  44 + end
  45 + end
  46 + end
  47 +end
... ...
spec/models/user_spec.rb
... ... @@ -13,6 +13,7 @@ describe User, :type =&gt; :model do
13 13 it { is_expected.to have_many(:project_attributes) }
14 14 it { is_expected.to have_many(:reading_group_attributes) }
15 15 it { is_expected.to have_many(:kalibro_configuration_attributes) }
  16 + it { is_expected.to have_many(:repository_attributes) }
16 17 end
17 18  
18 19 describe 'methods' do
... ...
spec/routing/repositories_routing_spec.rb
... ... @@ -2,29 +2,33 @@ require &quot;rails_helper&quot;
2 2  
3 3 describe RepositoriesController, :type => :routing do
4 4 describe "routing" do
5   - it { is_expected.to route(:post, '/projects/1/repositories').
6   - to(controller: :repositories, action: :create, project_id: 1) }
7   - it { is_expected.to route(:get, '/projects/1/repositories/new').
8   - to(controller: :repositories, action: :new, project_id: 1) }
9   - it { is_expected.to route(:get, '/projects/1/repositories/1/edit').
10   - to(controller: :repositories, action: :edit, project_id: 1, id: 1) }
11   - it { is_expected.to route(:get, '/projects/1/repositories/1').
12   - to(controller: :repositories, action: :show, project_id: 1, id: 1) }
13   - it { is_expected.to route(:get, '/projects/1/repositories/1/modules/1').
14   - to(controller: :repositories, action: :show, project_id: 1, module_result_id: 1, id: 1) }
15   - it { is_expected.to route(:delete, '/projects/1/repositories/1').
16   - to(controller: :repositories, action: :destroy, project_id: 1, id: 1) }
17   - it { is_expected.to route(:put, '/projects/1/repositories/1').
18   - to(controller: :repositories, action: :update, project_id: 1, id: 1) }
19   - it { is_expected.not_to route(:get, '/projects/1/repositories').
20   - to(controller: :repositories, action: :index, project_id: 1) }
21   - it { is_expected.to route(:post, '/projects/1/repositories/1/state').
22   - to(controller: :repositories, action: :state, project_id: 1, id: 1) }
23   - it { is_expected.to route(:post, '/projects/1/repositories/1/state_with_date').
24   - to(controller: :repositories, action: :state_with_date, project_id: 1, id: 1) }
25   - it { is_expected.to route(:get, '/projects/1/repositories/1/process').
26   - to(controller: :repositories, action: :process_repository, project_id: 1, id: 1) }
  5 + it { is_expected.to route(:post, '/repositories').
  6 + to(controller: :repositories, action: :create) }
  7 + it { is_expected.to route(:get, '/repositories/new').
  8 + to(controller: :repositories, action: :new) }
  9 + it { is_expected.to route(:get, '/repositories/1/edit').
  10 + to(controller: :repositories, action: :edit, id: 1) }
  11 + it { is_expected.to route(:get, '/repositories/1').
  12 + to(controller: :repositories, action: :show, id: 1) }
  13 + it { is_expected.to route(:get, '/repositories/1/modules/1').
  14 + to(controller: :repositories, action: :show, module_result_id: 1, id: 1) }
  15 + it { is_expected.to route(:delete, '/repositories/1').
  16 + to(controller: :repositories, action: :destroy, id: 1) }
  17 + it { is_expected.to route(:put, '/repositories/1').
  18 + to(controller: :repositories, action: :update, id: 1) }
  19 + it { is_expected.not_to route(:get, '/repositories').
  20 + to(controller: :repositories, action: :index) }
  21 + it { is_expected.to route(:post, '/repositories/1/state').
  22 + to(controller: :repositories, action: :state, id: 1) }
  23 + it { is_expected.to route(:post, '/repositories/1/state_with_date').
  24 + to(controller: :repositories, action: :state_with_date, id: 1) }
  25 + it { is_expected.to route(:get, '/repositories/1/process').
  26 + to(controller: :repositories, action: :process_repository, id: 1) }
27 27 it { is_expected.to route(:get, '/repository_branches').
28 28 to(controller: :repositories, action: :branches) }
  29 + it { is_expected.to route(:get, '/projects/1/repositories/new').
  30 + to(controller: :repositories, action: :new, project_id: 1) }
  31 + it { is_expected.to route(:post, '/projects/1/repositories').
  32 + to(controller: :repositories, action: :create, project_id: 1) }
29 33 end
30 34 end
... ...