fix admin/candidate[s] naming
This commit is contained in:
parent
0a9bf96e24
commit
aeef75bf8b
@ -19,7 +19,7 @@ module Admin
|
|||||||
|
|
||||||
if @candidate.persisted?
|
if @candidate.persisted?
|
||||||
send_notifications @candidate
|
send_notifications @candidate
|
||||||
redirect_to admin_candidate_path,
|
redirect_to admin_candidates_path,
|
||||||
flash: { success: "Sucessfully created candidate #{@candidate.name}" }
|
flash: { success: "Sucessfully created candidate #{@candidate.name}" }
|
||||||
else
|
else
|
||||||
flash[:error] = "Failed to save candidate."
|
flash[:error] = "Failed to save candidate."
|
||||||
@ -38,7 +38,7 @@ module Admin
|
|||||||
@candidate.update(candidate_params)
|
@candidate.update(candidate_params)
|
||||||
|
|
||||||
if @candidate.save
|
if @candidate.save
|
||||||
redirect_to admin_candidate_path, flash: { success: "#{@candidate.name} updated!" }
|
redirect_to admin_candidates_path, flash: { success: "#{@candidate.name} updated!" }
|
||||||
else
|
else
|
||||||
flash[:error] = "Failed to save candidate."
|
flash[:error] = "Failed to save candidate."
|
||||||
render :edit
|
render :edit
|
||||||
|
@ -40,7 +40,7 @@ Rails.application.routes.draw do
|
|||||||
post "/admin/profile", to: "admin/profile#update", as: :admin_update_profile
|
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/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
|
get "/admin/candidate/new", to: "admin/candidate#new", as: :admin_new_candidate
|
||||||
post "/admin/candidate/new", to: "admin/candidate#create", as: :admin_create_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
|
get "/admin/candidate/:id", to: "admin/candidate#edit", as: :admin_edit_candidate
|
||||||
|
@ -4,7 +4,7 @@ require 'test_helper'
|
|||||||
module Admin
|
module Admin
|
||||||
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||||
test "should require auth or redirect" do
|
test "should require auth or redirect" do
|
||||||
get admin_candidate_url
|
get admin_candidates_url
|
||||||
assert_redirected_to admin_login_url
|
assert_redirected_to admin_login_url
|
||||||
|
|
||||||
get admin_new_candidate_url
|
get admin_new_candidate_url
|
||||||
@ -16,14 +16,14 @@ module Admin
|
|||||||
|
|
||||||
test "should get candidate list" do
|
test "should get candidate list" do
|
||||||
auth_recruiter
|
auth_recruiter
|
||||||
get admin_candidate_url
|
get admin_candidates_url
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert assigns(:candidates), "@candidates not present"
|
assert assigns(:candidates), "@candidates not present"
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should have edit links' do
|
test 'should have edit links' do
|
||||||
auth_recruiter
|
auth_recruiter
|
||||||
get admin_candidate_url
|
get admin_candidates_url
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select "a[href='#{admin_edit_candidate_path(candidates(:martha))}']"
|
assert_select "a[href='#{admin_edit_candidate_path(candidates(:martha))}']"
|
||||||
end
|
end
|
||||||
|
@ -27,7 +27,7 @@ module Admin
|
|||||||
{ name: 'new name', email: 'test@mailinator.com', experience: '0-3', quiz_id: quizzes(:fed).id } }
|
{ name: 'new name', email: 'test@mailinator.com', experience: '0-3', quiz_id: quizzes(:fed).id } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_redirected_to admin_candidate_path
|
assert_redirected_to admin_candidates_path
|
||||||
assert flash[:success]
|
assert flash[:success]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Admin
|
|||||||
|
|
||||||
refute_equal candidate.name, Candidate.find_by(id: candidate.id).name
|
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_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
|
end
|
||||||
|
|
||||||
test 'should redirect to form on fail' do
|
test 'should redirect to form on fail' do
|
||||||
|
Loading…
Reference in New Issue
Block a user