Commit 3ae7d2c5c1b58fbdfc858e34d9c079e2c63341c5

Authored by Diego Camarinha
2 parents c4fa829d 5ee25d55

Merge pull request #307 from mezuro/fix_url_helpers

Replace url helpers by the path ones
app/controllers/concerns/ownership_authentication.rb
@@ -53,7 +53,7 @@ module OwnershipAuthentication @@ -53,7 +53,7 @@ module OwnershipAuthentication
53 def check_repository_ownership(id) 53 def check_repository_ownership(id)
54 if current_user.repository_attributes.find_by_repository_id(id).nil? 54 if current_user.repository_attributes.find_by_repository_id(id).nil?
55 respond_to do |format| 55 respond_to do |format|
56 - format.html { redirect_to projects_url, notice: t('not_allowed') } 56 + format.html { redirect_to projects_path, notice: t('not_allowed') }
57 format.json { head :no_content } 57 format.json { head :no_content }
58 end 58 end
59 end 59 end
@@ -65,7 +65,7 @@ module OwnershipAuthentication @@ -65,7 +65,7 @@ module OwnershipAuthentication
65 def check_project_ownership(id) 65 def check_project_ownership(id)
66 if current_user.project_attributes.find_by_project_id(id).nil? 66 if current_user.project_attributes.find_by_project_id(id).nil?
67 respond_to do |format| 67 respond_to do |format|
68 - format.html { redirect_to projects_url, notice: t('not_allowed') } 68 + format.html { redirect_to projects_path, notice: t('not_allowed') }
69 format.json { head :no_content } 69 format.json { head :no_content }
70 end 70 end
71 end 71 end
app/controllers/kalibro_configurations_controller.rb
@@ -54,7 +54,7 @@ class KalibroConfigurationsController < ApplicationController @@ -54,7 +54,7 @@ class KalibroConfigurationsController < ApplicationController
54 @kalibro_configuration.destroy 54 @kalibro_configuration.destroy
55 55
56 respond_to do |format| 56 respond_to do |format|
57 - format.html { redirect_to kalibro_configurations_url } 57 + format.html { redirect_to kalibro_configurations_path }
58 format.json { head :no_content } 58 format.json { head :no_content }
59 end 59 end
60 60
app/controllers/projects_controller.rb
@@ -56,7 +56,7 @@ class ProjectsController < ApplicationController @@ -56,7 +56,7 @@ class ProjectsController < ApplicationController
56 set_project 56 set_project
57 @project.destroy 57 @project.destroy
58 respond_to do |format| 58 respond_to do |format|
59 - format.html { redirect_to projects_url } 59 + format.html { redirect_to projects_path }
60 format.json { head :no_content } 60 format.json { head :no_content }
61 end 61 end
62 end 62 end
app/controllers/reading_groups_controller.rb
@@ -46,7 +46,7 @@ class ReadingGroupsController < ApplicationController @@ -46,7 +46,7 @@ class ReadingGroupsController < ApplicationController
46 def destroy 46 def destroy
47 @reading_group.destroy 47 @reading_group.destroy
48 respond_to do |format| 48 respond_to do |format|
49 - format.html { redirect_to reading_groups_url } 49 + format.html { redirect_to reading_groups_path }
50 format.json { head :no_content } 50 format.json { head :no_content }
51 end 51 end
52 end 52 end
spec/controllers/compound_metric_configurations_controller_spec.rb
@@ -28,8 +28,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do @@ -28,8 +28,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do
28 get :new, kalibro_configuration_id: kalibro_configuration.id 28 get :new, kalibro_configuration_id: kalibro_configuration.id
29 end 29 end
30 30
31 - it { is_expected.to redirect_to(kalibro_configurations_url(id: kalibro_configuration.id)) }  
32 - it { is_expected.to respond_with(:redirect) } 31 + it { is_expected.to redirect_to kalibro_configurations_path id: kalibro_configuration.id }
33 end 32 end
34 end 33 end
35 34
spec/controllers/kalibro_configurations_controller_spec.rb
@@ -106,11 +106,7 @@ describe KalibroConfigurationsController, :type => :controller do @@ -106,11 +106,7 @@ describe KalibroConfigurationsController, :type => :controller do
106 delete :destroy, :id => kalibro_configuration.id 106 delete :destroy, :id => kalibro_configuration.id
107 end 107 end
108 108
109 - it 'should redirect to the kalibro_configurations page' do  
110 - expect(response).to redirect_to kalibro_configurations_url  
111 - end  
112 -  
113 - it { is_expected.to respond_with(:redirect) } 109 + it { is_expected.to redirect_to kalibro_configurations_path }
114 end 110 end
115 111
116 context "when the user doesn't own the kalibro_configuration" do 112 context "when the user doesn't own the kalibro_configuration" do
spec/controllers/kalibro_ranges_controller_spec.rb
@@ -172,8 +172,7 @@ describe KalibroRangesController, :type => :controller do @@ -172,8 +172,7 @@ describe KalibroRangesController, :type => :controller do
172 get :edit, id: kalibro_range.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, metric_configuration_id: metric_configuration.id 172 get :edit, id: kalibro_range.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, metric_configuration_id: metric_configuration.id
173 end 173 end
174 174
175 - it { is_expected.to redirect_to(kalibro_configurations_url(id: metric_configuration.kalibro_configuration_id)) }  
176 - it { is_expected.to respond_with(:redirect) } 175 + it { is_expected.to redirect_to kalibro_configurations_path id: metric_configuration.kalibro_configuration_id }
177 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } 176 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") }
178 end 177 end
179 end 178 end
spec/controllers/metric_configurations_controller_spec.rb
@@ -53,8 +53,7 @@ describe MetricConfigurationsController, :type => :controller do @@ -53,8 +53,7 @@ describe MetricConfigurationsController, :type => :controller do
53 post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name 53 post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name
54 end 54 end
55 55
56 - it { is_expected.to redirect_to(kalibro_configurations_url(id: kalibro_configuration.id)) }  
57 - it { is_expected.to respond_with(:redirect) } 56 + it { is_expected.to redirect_to kalibro_configurations_path id: kalibro_configuration.id }
58 end 57 end
59 end 58 end
60 59
spec/controllers/projects_controller_spec.rb
@@ -119,11 +119,7 @@ describe ProjectsController, :type => :controller do @@ -119,11 +119,7 @@ describe ProjectsController, :type => :controller do
119 delete :destroy, :id => @subject.id 119 delete :destroy, :id => @subject.id
120 end 120 end
121 121
122 - it 'should redirect to the projects page' do  
123 - expect(response).to redirect_to projects_url  
124 - end  
125 -  
126 - it { is_expected.to respond_with(:redirect) } 122 + it { is_expected.to redirect_to projects_path }
127 end 123 end
128 124
129 context "when the user doesn't own the project" do 125 context "when the user doesn't own the project" do
spec/controllers/reading_groups_controller_spec.rb
@@ -94,11 +94,7 @@ describe ReadingGroupsController, :type => :controller do @@ -94,11 +94,7 @@ describe ReadingGroupsController, :type => :controller do
94 delete :destroy, :id => @subject.id 94 delete :destroy, :id => @subject.id
95 end 95 end
96 96
97 - it 'should redirect to the reading groups page' do  
98 - expect(response).to redirect_to reading_groups_url  
99 - end  
100 -  
101 - it { is_expected.to respond_with(:redirect) } 97 + it { is_expected.to redirect_to reading_groups_path }
102 end 98 end
103 99
104 context "when the user doesn't own the reading group" do 100 context "when the user doesn't own the reading group" do
@@ -118,7 +114,7 @@ describe ReadingGroupsController, :type => :controller do @@ -118,7 +114,7 @@ describe ReadingGroupsController, :type => :controller do
118 delete :destroy, :id => @subject.id 114 delete :destroy, :id => @subject.id
119 end 115 end
120 116
121 - it { is_expected.to redirect_to new_user_session_url } 117 + it { is_expected.to redirect_to new_user_session_path }
122 end 118 end
123 end 119 end
124 120
spec/controllers/readings_controller_spec.rb
@@ -23,8 +23,7 @@ describe ReadingsController, :type => :controller do @@ -23,8 +23,7 @@ describe ReadingsController, :type => :controller do
23 get :new, reading_group_id: reading_group.id 23 get :new, reading_group_id: reading_group.id
24 end 24 end
25 25
26 - it { is_expected.to redirect_to(reading_group_url(reading_group.id)) }  
27 - it { is_expected.to respond_with(:redirect) } 26 + it { is_expected.to redirect_to reading_group_path reading_group.id }
28 end 27 end
29 end 28 end
30 29
@@ -86,8 +85,7 @@ describe ReadingsController, :type => :controller do @@ -86,8 +85,7 @@ describe ReadingsController, :type => :controller do
86 get :edit, id: reading.id, reading_group_id: reading_group.id.to_s 85 get :edit, id: reading.id, reading_group_id: reading_group.id.to_s
87 end 86 end
88 87
89 - it { is_expected.to redirect_to(reading_group_url(reading_group.id)) }  
90 - it { is_expected.to respond_with(:redirect) } 88 + it { is_expected.to redirect_to reading_group_path reading_group.id }
91 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } 89 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") }
92 end 90 end
93 end 91 end
spec/controllers/repositories_controller_spec.rb
@@ -41,8 +41,7 @@ describe RepositoriesController, :type => :controller do @@ -41,8 +41,7 @@ describe RepositoriesController, :type => :controller do
41 get :new, project_id: project.id.to_s 41 get :new, project_id: project.id.to_s
42 end 42 end
43 43
44 - it { is_expected.to redirect_to(projects_url) }  
45 - it { is_expected.to respond_with(:redirect) } 44 + it { is_expected.to redirect_to(projects_path) }
46 end 45 end
47 end 46 end
48 47
@@ -120,8 +119,7 @@ describe RepositoriesController, :type => :controller do @@ -120,8 +119,7 @@ describe RepositoriesController, :type => :controller do
120 post :create, project_id: project.id, repository: repository_params 119 post :create, project_id: project.id, repository: repository_params
121 end 120 end
122 121
123 - it { is_expected.to redirect_to(projects_url) }  
124 - it { is_expected.to respond_with(:redirect) } 122 + it { is_expected.to redirect_to projects_path }
125 end 123 end
126 end 124 end
127 125
@@ -208,8 +206,7 @@ describe RepositoriesController, :type => :controller do @@ -208,8 +206,7 @@ describe RepositoriesController, :type => :controller do
208 delete :destroy, id: repository.id 206 delete :destroy, id: repository.id
209 end 207 end
210 208
211 - it { is_expected.to redirect_to(projects_url) }  
212 - it { is_expected.to respond_with(:redirect) } 209 + it { is_expected.to redirect_to projects_path }
213 end 210 end
214 end 211 end
215 212
@@ -249,8 +246,7 @@ describe RepositoriesController, :type => :controller do @@ -249,8 +246,7 @@ describe RepositoriesController, :type => :controller do
249 get :edit, id: repository.id 246 get :edit, id: repository.id
250 end 247 end
251 248
252 - it { is_expected.to redirect_to(projects_url) }  
253 - it { is_expected.to respond_with(:redirect) } 249 + it { is_expected.to redirect_to projects_path }
254 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } 250 it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") }
255 end 251 end
256 end 252 end