2017-10-26 21:19:30 +00:00
|
|
|
module Test.HTTPure.MethodSpec where
|
2017-09-26 06:08:07 +00:00
|
|
|
|
|
|
|
import Prelude
|
2022-05-04 21:02:29 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
import HTTPure.Method
|
|
|
|
( Method(Get, Post, Put, Delete, Head, Connect, Options, Trace, Patch)
|
|
|
|
, read
|
|
|
|
)
|
2022-05-04 21:02:29 +00:00
|
|
|
import Test.HTTPure.TestHelpers (Test, mockRequest, (?=))
|
|
|
|
import Test.Spec (describe, it)
|
2017-09-26 06:08:07 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
showSpec :: Test
|
2021-03-22 19:02:36 +00:00
|
|
|
showSpec =
|
2021-11-19 06:16:35 +00:00
|
|
|
describe "show" do
|
|
|
|
describe "with a Get" do
|
|
|
|
it "is 'Get'" do
|
|
|
|
show Get ?= "Get"
|
|
|
|
describe "with a Post" do
|
|
|
|
it "is 'Post'" do
|
|
|
|
show Post ?= "Post"
|
|
|
|
describe "with a Put" do
|
|
|
|
it "is 'Put'" do
|
|
|
|
show Put ?= "Put"
|
|
|
|
describe "with a Delete" do
|
|
|
|
it "is 'Delete'" do
|
|
|
|
show Delete ?= "Delete"
|
|
|
|
describe "with a Head" do
|
|
|
|
it "is 'Head'" do
|
|
|
|
show Head ?= "Head"
|
|
|
|
describe "with a Connect" do
|
|
|
|
it "is 'Connect'" do
|
|
|
|
show Connect ?= "Connect"
|
|
|
|
describe "with a Options" do
|
|
|
|
it "is 'Options'" do
|
|
|
|
show Options ?= "Options"
|
|
|
|
describe "with a Trace" do
|
|
|
|
it "is 'Trace'" do
|
|
|
|
show Trace ?= "Trace"
|
|
|
|
describe "with a Patch" do
|
|
|
|
it "is 'Patch'" do
|
|
|
|
show Patch ?= "Patch"
|
2017-09-26 06:08:07 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
readSpec :: Test
|
2021-03-22 19:02:36 +00:00
|
|
|
readSpec =
|
2021-11-19 06:16:35 +00:00
|
|
|
describe "read" do
|
|
|
|
describe "with a 'GET' Request" do
|
|
|
|
it "is Get" do
|
|
|
|
request <- mockRequest "" "GET" "" "" []
|
|
|
|
read request ?= Get
|
2017-09-26 06:08:07 +00:00
|
|
|
|
2021-11-19 06:16:35 +00:00
|
|
|
methodSpec :: Test
|
2021-03-22 19:02:36 +00:00
|
|
|
methodSpec =
|
2021-11-19 06:16:35 +00:00
|
|
|
describe "Method" do
|
2021-03-22 19:02:36 +00:00
|
|
|
showSpec
|
|
|
|
readSpec
|