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

Re-export lifted Test.Hspec expectations #24

Closed
wants to merge 4 commits into from

Conversation

Jonplussed
Copy link
Contributor

Addresses #22

@Jonplussed
Copy link
Contributor Author

This is failing when Travis builds README.lhs. Does anybody understand the error? That isn't a file edited in this pull request.

@sol
Copy link
Member

sol commented Oct 29, 2014

@Jonplussed Sorry for getting back late. This looks mostly good. There are some minor things I'd like to change, I'll add comments inline.

I think the build failure is due to Test.Hspec.Wai.Expectation missing from the other-modules field in the cabal file.

@@ -0,0 +1,74 @@
module Test.Hspec.Wai.Expectation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though I tend to follow the convention to use singular for almost everything, I would still go for Test.Hspec.Wai.Expectations here, because we already have Test.Hspec.Expectations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in caba301

@Jonplussed
Copy link
Contributor Author

Thanks for the notes; will edit and resubmit.

94b151e

- rename Test.Hspec.Wai.Expectation to Test.Hspec.Wai.Expectations
- add documentation to lift Test.Hspec functions
- import Test.Hspec.Expectations rather than Test.Hspec to future-proof
@Jonplussed
Copy link
Contributor Author

The build is still failing on with the message The command "ghc --make -package hspec2 -Wall -Werror -pgmLmarkdown-unlit README.lhs" exited with 1. Watching the build, it seems the README.lhs is being run while not containing fully-runnable Haskell code.

Was this file perhaps added to the repo outside of a pull request, bypassing the build server?

@sol
Copy link
Member

sol commented Nov 1, 2014

The compile error is in test/Test/Hspec/Wai/JSONSpec.hs:25:48:, due to the re-exports.

@sol
Copy link
Member

sol commented Nov 1, 2014

(see a6a54ba)

@sol
Copy link
Member

sol commented Nov 1, 2014

Now that we already have name clashes, I'm actually inclined to rename shouldRespondWith to shouldReturn. I assume that shouldRespondWith is the most commonly needed combinator when testing a web app, so I would love to have the short name for it :).

And if somebody really needs the current shouldReturn-semantics, that is a trivial variation of shouldBe, say:

action `shouldReturn` 23

can be expressed as

action >>= (`shouldBe` 23)

@sol
Copy link
Member

sol commented Nov 1, 2014

Oh, and we can actually depend on hspec-expectations-lifted.

@sol
Copy link
Member

sol commented Nov 1, 2014

Just pushed it to master. Thanks a lot!

@Jonplussed
Copy link
Contributor Author

😄 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants