recruiter login + index
This commit is contained in:
56
test/controllers/recruiter_controller_test.rb
Normal file
56
test/controllers/recruiter_controller_test.rb
Normal file
@ -0,0 +1,56 @@
|
||||
require 'test_helper'
|
||||
|
||||
class RecruiterControllerTest < ActionDispatch::IntegrationTest
|
||||
def setup_auth
|
||||
post recruiter_auth_url, params: { auth:
|
||||
{ email: 'pdr.recruiter@mailinator.com', password: 'password' } }
|
||||
end
|
||||
|
||||
test "should get login" do
|
||||
get recruiter_login_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should require auth or redirect" do
|
||||
get recruiter_url
|
||||
assert_redirected_to recruiter_login_path
|
||||
|
||||
get new_candidate_url
|
||||
assert_redirected_to recruiter_login_path
|
||||
|
||||
post create_candidate_url, params: { candidate: { name: 'foo', email: 'bar', experience: 'baz' } }
|
||||
assert_redirected_to recruiter_login_path
|
||||
end
|
||||
|
||||
test "should auth to index" do
|
||||
setup_auth
|
||||
assert_redirected_to recruiter_path
|
||||
assert session[:user].present?
|
||||
end
|
||||
|
||||
test "should fail auth with flash" do
|
||||
post recruiter_auth_url, params: { auth:
|
||||
{ email: 'pdr.recruiter@mailinator.com', password: 'bad-password' } }
|
||||
|
||||
assert_redirected_to recruiter_login_path
|
||||
assert flash[:error]
|
||||
end
|
||||
|
||||
test "should get candidate list" do
|
||||
setup_auth
|
||||
get recruiter_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
setup_auth
|
||||
get new_candidate_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get create" do
|
||||
setup_auth
|
||||
get create_candidate_url
|
||||
assert_response :success
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user