42bf4475e0
* Update shell and packages * Fix code for 0.15 * Fix tests * Format * Add check-pulp command * Generate bowerfile * Add check-pulp to CI * Add nixfmt to formatting * Fixup test helpers * Take 2 * PR comments (#1) * Nix cleanup from PR * Use arrows functions * Remove unnecessary step Co-authored-by: Connor Prussin <connor@prussin.net>
56 lines
1.3 KiB
Haskell
56 lines
1.3 KiB
Haskell
module Test.HTTPure.MethodSpec where
|
|
|
|
import Prelude
|
|
|
|
import HTTPure.Method
|
|
( Method(Get, Post, Put, Delete, Head, Connect, Options, Trace, Patch)
|
|
, read
|
|
)
|
|
import Test.HTTPure.TestHelpers (Test, mockRequest, (?=))
|
|
import Test.Spec (describe, it)
|
|
|
|
showSpec :: Test
|
|
showSpec =
|
|
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"
|
|
|
|
readSpec :: Test
|
|
readSpec =
|
|
describe "read" do
|
|
describe "with a 'GET' Request" do
|
|
it "is Get" do
|
|
request <- mockRequest "" "GET" "" "" []
|
|
read request ?= Get
|
|
|
|
methodSpec :: Test
|
|
methodSpec =
|
|
describe "Method" do
|
|
showSpec
|
|
readSpec
|