2024-05-26 10:45:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-05-26 09:34:09 +00:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class AdminControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test "should get index if signed in as admin" do
|
|
|
|
sign_in users(:admin)
|
|
|
|
get admin_index_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should not get index if signed in as non-admin user" do
|
|
|
|
sign_in users(:trevor)
|
|
|
|
get admin_index_url
|
|
|
|
assert_response :forbidden
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should not get index if not signed in" do
|
|
|
|
get admin_index_url
|
|
|
|
assert_redirected_to login_path
|
|
|
|
end
|
|
|
|
end
|