hspec / hspec-wai

Helpers to test WAI applications with Hspec
MIT License
64 stars 25 forks source link

Test.Hspec.Wai should shadow lifted Test.Hspec functions #22

Open Jonplussed opened 9 years ago

Jonplussed commented 9 years ago

Rather than requiring conflicting imports from both Test.Hspec and Test.Hspec.Wai, Test.Hspec.Wai could export all of Test.Hspec, replacing the functions that need lifting, such as render or shouldBe, with the lifted versions.

This seems unlikely to cause problems, since anybody using both test suites in the same file should probably have them qualified to avoid conflicts even in the current iteration. Will send a pull if going this route sounds worthwhile to you.

sol commented 9 years ago

Hey, Yes, you are right. I already started in that direction on branch https://github.com/hspec/hspec-wai/tree/re-exports. Do you want to take a look, augment it if needed and open a PR?

Jonplussed commented 9 years ago

After inspecting, the only functions missing seemed to be the expectations in hspec-expectations, which just need lifting to work within a WaiExpectation. Addressed in https://github.com/hspec/hspec-wai/pull/24.

sol commented 9 years ago

I reverted this, because from my perspective it's not entirely clear what we would need to re-export and what not (e.g. what about hooks). The underlying issues as I see it is that re-exporting everything dose not compose well.

The current situation is not ideal, as we have a name conflict for pending and pendingWith, so I hope we can come up with something better in the future (maybe finding module boundaries where a user can import the things he wants to use).

(read: I acknowledge that there is a problem we need to fix, but right now I need to cut a release and I don't know what the right solution is.)

Jonplussed commented 9 years ago

@sol No problem; happy to contribute ideas regardless. Thanks for all of your work on Hspec.