From aeef75bf8bbc96d3311ae3312abedcc9e99747c2 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Thu, 22 Sep 2016 14:21:34 -0500 Subject: [PATCH] fix admin/candidate[s] naming --- app/controllers/admin/candidate_controller.rb | 4 ++-- config/routes.rb | 2 +- test/controllers/admin/candidate_controller/index_test.rb | 6 +++--- .../admin/candidate_controller/new_candidate_test.rb | 2 +- .../admin/candidate_controller/update_candidate_test.rb | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/candidate_controller.rb b/app/controllers/admin/candidate_controller.rb index 6eaf61f..85f4d2b 100644 --- a/app/controllers/admin/candidate_controller.rb +++ b/app/controllers/admin/candidate_controller.rb @@ -19,7 +19,7 @@ module Admin if @candidate.persisted? send_notifications @candidate - redirect_to admin_candidate_path, + redirect_to admin_candidates_path, flash: { success: "Sucessfully created candidate #{@candidate.name}" } else flash[:error] = "Failed to save candidate." @@ -38,7 +38,7 @@ module Admin @candidate.update(candidate_params) if @candidate.save - redirect_to admin_candidate_path, flash: { success: "#{@candidate.name} updated!" } + redirect_to admin_candidates_path, flash: { success: "#{@candidate.name} updated!" } else flash[:error] = "Failed to save candidate." render :edit diff --git a/config/routes.rb b/config/routes.rb index 2691c85..c5356dd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -40,7 +40,7 @@ Rails.application.routes.draw do post "/admin/profile", to: "admin/profile#update", as: :admin_update_profile get "/admin/profile/edit", to: "admin/profile#edit", as: :admin_edit_profile - get "/admin/candidate", to: "admin/candidate#index", as: :admin_candidate + get "/admin/candidates", to: "admin/candidate#index", as: :admin_candidates get "/admin/candidate/new", to: "admin/candidate#new", as: :admin_new_candidate post "/admin/candidate/new", to: "admin/candidate#create", as: :admin_create_candidate get "/admin/candidate/:id", to: "admin/candidate#edit", as: :admin_edit_candidate diff --git a/test/controllers/admin/candidate_controller/index_test.rb b/test/controllers/admin/candidate_controller/index_test.rb index d9c2b11..cd6ebe0 100644 --- a/test/controllers/admin/candidate_controller/index_test.rb +++ b/test/controllers/admin/candidate_controller/index_test.rb @@ -4,7 +4,7 @@ require 'test_helper' module Admin class CandidateControllerTest < ActionDispatch::IntegrationTest test "should require auth or redirect" do - get admin_candidate_url + get admin_candidates_url assert_redirected_to admin_login_url get admin_new_candidate_url @@ -16,14 +16,14 @@ module Admin test "should get candidate list" do auth_recruiter - get admin_candidate_url + get admin_candidates_url assert_response :success assert assigns(:candidates), "@candidates not present" end test 'should have edit links' do auth_recruiter - get admin_candidate_url + get admin_candidates_url assert_response :success assert_select "a[href='#{admin_edit_candidate_path(candidates(:martha))}']" end diff --git a/test/controllers/admin/candidate_controller/new_candidate_test.rb b/test/controllers/admin/candidate_controller/new_candidate_test.rb index 50fb582..c59f58c 100644 --- a/test/controllers/admin/candidate_controller/new_candidate_test.rb +++ b/test/controllers/admin/candidate_controller/new_candidate_test.rb @@ -27,7 +27,7 @@ module Admin { name: 'new name', email: 'test@mailinator.com', experience: '0-3', quiz_id: quizzes(:fed).id } } end end - assert_redirected_to admin_candidate_path + assert_redirected_to admin_candidates_path assert flash[:success] end diff --git a/test/controllers/admin/candidate_controller/update_candidate_test.rb b/test/controllers/admin/candidate_controller/update_candidate_test.rb index 25a6efc..e4b2779 100644 --- a/test/controllers/admin/candidate_controller/update_candidate_test.rb +++ b/test/controllers/admin/candidate_controller/update_candidate_test.rb @@ -20,7 +20,7 @@ module Admin refute_equal candidate.name, Candidate.find_by(id: candidate.id).name assert_equal candidate.test_hash, Candidate.find_by(id: candidate.id).test_hash - assert_redirected_to admin_candidate_url + assert_redirected_to admin_candidates_url end test 'should redirect to form on fail' do