skill-assessment-app/test/controllers/review_controller_test.rb
Mark Moser ace9b864d3 review
2016-07-31 16:34:35 -05:00

56 lines
1.2 KiB
Ruby

require 'test_helper'
class ReviewControllerTest < ActionDispatch::IntegrationTest
def setup_auth
post review_auth_url, params: { auth:
{ email: 'fed.reviewer@mailinator.com', password: 'password' } }
end
test "should get login" do
get review_login_url
assert_response :success
end
test "should require auth or redirect" do
get review_url
assert_redirected_to review_login_path
get review_test_url(candidates(:richard).test_hash)
assert_redirected_to review_login_path
end
test "should auth to index" do
setup_auth
assert_redirected_to review_path
assert session[:user].present?
end
test "should fail auth with flash" do
post review_auth_url, params: { auth:
{ email: 'fed.review@mailinator.com', password: 'bad-password' } }
assert_redirected_to review_login_path
assert flash[:error]
end
test "should get review list" do
setup_auth
get review_url
assert_response :success
end
test "should get index" do
setup_auth
get review_url
assert_response :success
end
test "should get view" do
setup_auth
get review_test_url(candidates(:richard).test_hash)
assert_response :success
end
end