Skip to content

Commit 4d83db1

Browse files
committed
Remove _school prefix from verify/reject school routes
These are member routes for a school so including school in the name is unnecessary.
1 parent eb2976c commit 4d83db1

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

app/controllers/admin/schools_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Admin
44
class SchoolsController < Admin::ApplicationController
5-
def verify_school
5+
def verify
66
school_id = params[:id]
77
service = SchoolVerificationService.new(school_id)
88

@@ -15,7 +15,7 @@ def verify_school
1515
redirect_to admin_school_path(id: school_id)
1616
end
1717

18-
def reject_school
18+
def reject
1919
school_id = params[:id]
2020
service = SchoolVerificationService.new(school_id)
2121

app/views/admin/schools/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ as well as a link to its edit page.
3232

3333
<%= link_to(
3434
t("administrate.actions.verify_school"),
35-
verify_school_admin_school_path(page.resource),
35+
verify_admin_school_path(page.resource),
3636
class: "button button--verify",
3737
method: :post,
3838
style: "background-color: green; margin: 5px;",
@@ -41,7 +41,7 @@ as well as a link to its edit page.
4141

4242
<%= link_to(
4343
t("administrate.actions.reject_school"),
44-
reject_school_admin_school_path(page.resource),
44+
reject_admin_school_path(page.resource),
4545
class: "button button--danger",
4646
method: :patch,
4747
style: "background-color: hsla(0, 88%, 33%, 1); margin: 5px 5px 5px 0;",

config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
resources :schools, only: %i[index show edit update] do
1414
member do
15-
post :verify_school
16-
patch :reject_school
15+
post :verify
16+
patch :reject
1717
end
1818
end
1919

spec/features/admin/schools_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
end
6565
end
6666

67-
describe 'POST #verify_school' do
67+
describe 'POST #verify' do
6868
let(:creator) { create(:user) }
6969
let(:verified_at) { nil }
7070
let(:school) { create(:school, creator_id: creator.id, verified_at:) }
@@ -75,7 +75,7 @@
7575
stub_user_info_api_for(creator)
7676
allow(SchoolVerificationService).to receive(:new).with(school.id).and_return(verification_service)
7777

78-
post verify_school_admin_school_path(school)
78+
post verify_admin_school_path(school)
7979
end
8080

8181
it 'redirects to school path' do
@@ -107,7 +107,7 @@
107107
end
108108
end
109109

110-
describe 'PUT #reject_school' do
110+
describe 'PUT #reject' do
111111
let(:creator) { create(:user) }
112112
let(:school) { create(:school, creator_id: creator.id) }
113113
let(:rejection_result) { nil }
@@ -117,7 +117,7 @@
117117
stub_user_info_api_for(creator)
118118
allow(SchoolVerificationService).to receive(:new).with(school.id).and_return(verification_service)
119119

120-
patch reject_school_admin_school_path(school)
120+
patch reject_admin_school_path(school)
121121
end
122122

123123
it 'redirects to school path' do

0 commit comments

Comments
 (0)