32 lines
904 B
Ruby
32 lines
904 B
Ruby
|
# frozen_string_literal: true
|
||
|
require 'test_helper'
|
||
|
|
||
|
module Admin
|
||
|
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||
|
test "should require auth or redirect" do
|
||
|
get admin_candidate_url
|
||
|
assert_redirected_to admin_login_url
|
||
|
|
||
|
get admin_new_candidate_url
|
||
|
assert_redirected_to admin_login_url
|
||
|
|
||
|
post admin_create_candidate_url, params: { candidate: { name: 'foo', email: 'bar', experience: 'baz' } }
|
||
|
assert_redirected_to admin_login_url
|
||
|
end
|
||
|
|
||
|
test "should get candidate list" do
|
||
|
auth_recruiter
|
||
|
get admin_candidate_url
|
||
|
assert_response :success
|
||
|
assert assigns(:candidates), "@candidates not present"
|
||
|
end
|
||
|
|
||
|
test 'should have edit links' do
|
||
|
auth_recruiter
|
||
|
get admin_candidate_url
|
||
|
assert_response :success
|
||
|
assert_select "a[href='#{admin_edit_candidate_path(candidates(:martha))}']"
|
||
|
end
|
||
|
end
|
||
|
end
|