Commit 3ae7d2c5c1b58fbdfc858e34d9c079e2c63341c5
Exists in
colab
and in
4 other branches
Merge pull request #307 from mezuro/fix_url_helpers
Replace url helpers by the path ones
Showing
12 changed files
with
18 additions
and
39 deletions
Show diff stats
app/controllers/concerns/ownership_authentication.rb
| ... | ... | @@ -53,7 +53,7 @@ module OwnershipAuthentication |
| 53 | 53 | def check_repository_ownership(id) |
| 54 | 54 | if current_user.repository_attributes.find_by_repository_id(id).nil? |
| 55 | 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 | 57 | format.json { head :no_content } |
| 58 | 58 | end |
| 59 | 59 | end |
| ... | ... | @@ -65,7 +65,7 @@ module OwnershipAuthentication |
| 65 | 65 | def check_project_ownership(id) |
| 66 | 66 | if current_user.project_attributes.find_by_project_id(id).nil? |
| 67 | 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 | 69 | format.json { head :no_content } |
| 70 | 70 | end |
| 71 | 71 | end | ... | ... |
app/controllers/kalibro_configurations_controller.rb
| ... | ... | @@ -54,7 +54,7 @@ class KalibroConfigurationsController < ApplicationController |
| 54 | 54 | @kalibro_configuration.destroy |
| 55 | 55 | |
| 56 | 56 | respond_to do |format| |
| 57 | - format.html { redirect_to kalibro_configurations_url } | |
| 57 | + format.html { redirect_to kalibro_configurations_path } | |
| 58 | 58 | format.json { head :no_content } |
| 59 | 59 | end |
| 60 | 60 | ... | ... |
app/controllers/projects_controller.rb
| ... | ... | @@ -56,7 +56,7 @@ class ProjectsController < ApplicationController |
| 56 | 56 | set_project |
| 57 | 57 | @project.destroy |
| 58 | 58 | respond_to do |format| |
| 59 | - format.html { redirect_to projects_url } | |
| 59 | + format.html { redirect_to projects_path } | |
| 60 | 60 | format.json { head :no_content } |
| 61 | 61 | end |
| 62 | 62 | end | ... | ... |
app/controllers/reading_groups_controller.rb
| ... | ... | @@ -46,7 +46,7 @@ class ReadingGroupsController < ApplicationController |
| 46 | 46 | def destroy |
| 47 | 47 | @reading_group.destroy |
| 48 | 48 | respond_to do |format| |
| 49 | - format.html { redirect_to reading_groups_url } | |
| 49 | + format.html { redirect_to reading_groups_path } | |
| 50 | 50 | format.json { head :no_content } |
| 51 | 51 | end |
| 52 | 52 | end | ... | ... |
spec/controllers/compound_metric_configurations_controller_spec.rb
| ... | ... | @@ -28,8 +28,7 @@ describe CompoundMetricConfigurationsController, :type => :controller do |
| 28 | 28 | get :new, kalibro_configuration_id: kalibro_configuration.id |
| 29 | 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 | 32 | end |
| 34 | 33 | end |
| 35 | 34 | ... | ... |
spec/controllers/kalibro_configurations_controller_spec.rb
| ... | ... | @@ -106,11 +106,7 @@ describe KalibroConfigurationsController, :type => :controller do |
| 106 | 106 | delete :destroy, :id => kalibro_configuration.id |
| 107 | 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 | 110 | end |
| 115 | 111 | |
| 116 | 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 | 172 | get :edit, id: kalibro_range.id, kalibro_configuration_id: metric_configuration.kalibro_configuration_id, metric_configuration_id: metric_configuration.id |
| 173 | 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 | 176 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
| 178 | 177 | end |
| 179 | 178 | end | ... | ... |
spec/controllers/metric_configurations_controller_spec.rb
| ... | ... | @@ -53,8 +53,7 @@ describe MetricConfigurationsController, :type => :controller do |
| 53 | 53 | post :new, kalibro_configuration_id: kalibro_configuration.id, metric_name: "Lines of Code", metric_collector_name: metric_collector.name |
| 54 | 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 | 57 | end |
| 59 | 58 | end |
| 60 | 59 | ... | ... |
spec/controllers/projects_controller_spec.rb
| ... | ... | @@ -119,11 +119,7 @@ describe ProjectsController, :type => :controller do |
| 119 | 119 | delete :destroy, :id => @subject.id |
| 120 | 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 | 123 | end |
| 128 | 124 | |
| 129 | 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 | 94 | delete :destroy, :id => @subject.id |
| 95 | 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 | 98 | end |
| 103 | 99 | |
| 104 | 100 | context "when the user doesn't own the reading group" do |
| ... | ... | @@ -118,7 +114,7 @@ describe ReadingGroupsController, :type => :controller do |
| 118 | 114 | delete :destroy, :id => @subject.id |
| 119 | 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 | 118 | end |
| 123 | 119 | end |
| 124 | 120 | ... | ... |
spec/controllers/readings_controller_spec.rb
| ... | ... | @@ -23,8 +23,7 @@ describe ReadingsController, :type => :controller do |
| 23 | 23 | get :new, reading_group_id: reading_group.id |
| 24 | 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 | 27 | end |
| 29 | 28 | end |
| 30 | 29 | |
| ... | ... | @@ -86,8 +85,7 @@ describe ReadingsController, :type => :controller do |
| 86 | 85 | get :edit, id: reading.id, reading_group_id: reading_group.id.to_s |
| 87 | 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 | 89 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
| 92 | 90 | end |
| 93 | 91 | end | ... | ... |
spec/controllers/repositories_controller_spec.rb
| ... | ... | @@ -41,8 +41,7 @@ describe RepositoriesController, :type => :controller do |
| 41 | 41 | get :new, project_id: project.id.to_s |
| 42 | 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 | 45 | end |
| 47 | 46 | end |
| 48 | 47 | |
| ... | ... | @@ -120,8 +119,7 @@ describe RepositoriesController, :type => :controller do |
| 120 | 119 | post :create, project_id: project.id, repository: repository_params |
| 121 | 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 | 123 | end |
| 126 | 124 | end |
| 127 | 125 | |
| ... | ... | @@ -208,8 +206,7 @@ describe RepositoriesController, :type => :controller do |
| 208 | 206 | delete :destroy, id: repository.id |
| 209 | 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 | 210 | end |
| 214 | 211 | end |
| 215 | 212 | |
| ... | ... | @@ -249,8 +246,7 @@ describe RepositoriesController, :type => :controller do |
| 249 | 246 | get :edit, id: repository.id |
| 250 | 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 | 250 | it { is_expected.to set_flash[:notice].to("You're not allowed to do this operation") } |
| 255 | 251 | end |
| 256 | 252 | end | ... | ... |