move recruiter to admin/candidate
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
require 'test_helper'
|
||||
|
||||
module Admin
|
||||
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||
test 'should edit candidate' do
|
||||
auth_recruiter
|
||||
candidate = candidates(:martha)
|
||||
|
||||
get admin_edit_candidate_path(candidate.id)
|
||||
assert_response :success
|
||||
assert_select 'form'
|
||||
end
|
||||
|
||||
test 'should update candidate, but NOT test_hash' do
|
||||
auth_recruiter
|
||||
candidate = candidates(:martha)
|
||||
post admin_update_candidate_url(id: candidate.id), params:
|
||||
{ candidate: { name: 'new name', email: "mail@martha.me", test_hash: 'SOMENEWSTRING' } }
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
test 'should redirect to form on fail' do
|
||||
auth_recruiter
|
||||
candidate = candidates(:martha)
|
||||
post admin_update_candidate_url(id: candidate.id), params:
|
||||
{ candidate: { name: 'new name', email: "mail@martha" } }
|
||||
|
||||
assert :success
|
||||
assert_match(/failed.*save/i, flash[:error])
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user