Split StructureSpec into OpenApiSpec and OptionsSpec

This commit is contained in:
Wolfgang Walther
2020-11-20 11:51:49 -05:00
committed by Steve Chavez
parent d91f47e582
commit 944efb3a6a
5 changed files with 536 additions and 524 deletions
+26
View File
@@ -0,0 +1,26 @@
module Feature.OptionsSpec where
import Network.Wai (Application)
import Network.Wai.Test (SResponse (..))
import Network.HTTP.Types
import Test.Hspec
import Test.Hspec.Wai
import Protolude
import SpecHelper
spec :: SpecWith ((), Application)
spec = describe "Allow header" $ do
it "includes read/write verbs for writeable table" $ do
r <- request methodOptions "/items" [] ""
liftIO $
simpleHeaders r `shouldSatisfy`
matchHeader "Allow" "GET,POST,PATCH,DELETE"
it "includes read verbs for read-only table" $ do
r <- request methodOptions "/has_count_column" [] ""
liftIO $
simpleHeaders r `shouldSatisfy`
matchHeader "Allow" "GET"