move recruiter to admin/candidate

This commit is contained in:
Mark Moser
2016-09-22 13:30:30 -05:00
parent 47d7188a2f
commit 9078c463f4
25 changed files with 383 additions and 327 deletions

View File

@ -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