Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for hspec-wai 0.5.* #122

Merged
merged 1 commit into from Sep 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion scotty.cabal
Expand Up @@ -99,7 +99,7 @@ test-suite spec
lifted-base,
wai,
hspec2,
hspec-wai >= 0.4.1,
hspec-wai >= 0.5,
scotty
GHC-options: -Wall -fno-warn-orphans

Expand Down
10 changes: 5 additions & 5 deletions test/Web/ScottySpec.hs
Expand Up @@ -98,11 +98,11 @@ spec = do
get "/scotty" `shouldRespondWith` modernGreekText

it "sets Content-Type header to \"text/plain; charset=utf-8\"" $ do
get "/scotty" `shouldRespondWith` 200 {matchHeaders = [("Content-Type", "text/plain; charset=utf-8")]}
get "/scotty" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8"]}

withApp (Scotty.get "/scotty" $ setHeader "Content-Type" "text/somethingweird" >> text modernGreekText) $ do
it "doesn't override a previously set Content-Type header" $ do
get "/scotty" `shouldRespondWith` 200 {matchHeaders = [("Content-Type", "text/somethingweird")]}
get "/scotty" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/somethingweird"]}

describe "html" $ do
let russianLanguageTextInHtml :: IsString a => a
Expand All @@ -113,13 +113,13 @@ spec = do
get "/scotty" `shouldRespondWith` russianLanguageTextInHtml

it "sets Content-Type header to \"text/html; charset=utf-8\"" $ do
get "/scotty" `shouldRespondWith` 200 {matchHeaders = [("Content-Type", "text/html; charset=utf-8")]}
get "/scotty" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/html; charset=utf-8"]}

withApp (Scotty.get "/scotty" $ setHeader "Content-Type" "text/somethingweird" >> html russianLanguageTextInHtml) $ do
it "doesn't override a previously set Content-Type header" $ do
get "/scotty" `shouldRespondWith` 200 {matchHeaders = [("Content-Type", "text/somethingweird")]}
get "/scotty" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/somethingweird"]}

describe "json" $ do
withApp (Scotty.get "/scotty" $ setHeader "Content-Type" "text/somethingweird" >> json (Just (5::Int))) $ do
it "doesn't override a previously set Content-Type header" $ do
get "/scotty" `shouldRespondWith` 200 {matchHeaders = [("Content-Type", "text/somethingweird")]}
get "/scotty" `shouldRespondWith` 200 {matchHeaders = ["Content-Type" <:> "text/somethingweird"]}