2016-09-22 13:30:30 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test "should require auth or redirect" do
|
2016-09-22 14:21:34 -05:00
|
|
|
get admin_candidates_url
|
2016-09-22 13:30:30 -05:00
|
|
|
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
|
2016-09-22 14:21:34 -05:00
|
|
|
get admin_candidates_url
|
2016-09-22 13:30:30 -05:00
|
|
|
assert_response :success
|
|
|
|
assert assigns(:candidates), "@candidates not present"
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'should have edit links' do
|
|
|
|
auth_recruiter
|
2016-09-22 14:21:34 -05:00
|
|
|
get admin_candidates_url
|
2016-09-22 13:30:30 -05:00
|
|
|
assert_response :success
|
2017-05-04 07:49:10 -05:00
|
|
|
assert_select "a[href='#{admin_edit_candidate_path(candidates(:gillian))}']"
|
2016-09-22 13:30:30 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|