skill-assessment-app/test/controllers/admin/candidate_controller/index_test.rb

32 lines
908 B
Ruby
Raw Permalink Normal View History

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
assert_select "a[href='#{admin_edit_candidate_path(candidates(:gillian))}']"
2016-09-22 13:30:30 -05:00
end
end
end