fradrive/test/Handler/ProfileSpec.hs
2018-10-31 23:55:29 +01:00

24 lines
673 B
Haskell

{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Handler.ProfileSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
describe "Profile page" $ do
it "asserts no access to my-account for anonymous users" $ do
get ProfileR
loc <- getLocation
assertEq "Redirect is to Login" loc
either (fail . unpack) (\_ -> return ()) =<< followRedirect
statusIs 200
it "asserts access to my-account for authenticated users" $ do
userEntity <- createUser "foo"
authenticateAs userEntity
get ProfileR
statusIs 200