-
Notifications
You must be signed in to change notification settings - Fork 25
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
added Test.Hspec.Wai.Server #30
Conversation
Strictly speaking this also has nothing to do with |
@soenkehahn sorry for the delay. I imagine it should be possible to test WAI applications both directly (that is what we currently do) and through HTTP (by starting warp and doing proper HTTP requests, I assume what you are doing) with the same API. We would change the state of the with :: IO Application -> SpecWith (Either Application Port) -> Spec and withSocket :: IO Application -> SpecWith (Either Application Port) -> Spec that pass on the application or start warp and pass on the port respectively. Does this make sense? If we go for that approach, then Going even further, we could make this even more extensible by using some action of type
as the state of the session. That way you could test arbitrary HTTP applications, directly or through some server, with the same API. That would also mean that e.g. @dbp could adapt |
@soenkehahn I created #31 to illustrate what I meant in my previous comment. If you think that is a good idea, still needs some cleanup, documentation, tests, etc... |
Also, sorry for the delay. Christmas got in the way. The two use-cases that prompted me to add Another idea is this: Why don't we remove the direct testing and replace it completely with the HTTP-based testing? Then we provide an additional function like @sol: wdyt? |
@sol: Any thoughts on this? Today I stumbled upon a situation where I need to test an |
On the other hand by now I think that this would ideally go into the @snoyberg: Would you be interested in a PR that adds
|
No objection in principle to the addition of such functions to warp, though On Thu, Feb 11, 2016 at 3:01 PM, Sönke Hahn [email protected]
|
@soenkehahn I'm in favor of adding As for |
This is part of |
This commit adds a helper function that allows to test wai
Application
s over a real port. This is very different from the approach inTest.Hspec.Wai
but I still think this is the best place for this helper function.