waterlink / spec2.cr

Enhanced `spec` testing library for [Crystal](http://crystal-lang.org/).
MIT License
103 stars 22 forks source link

Any elegant way to test matchers/expectations for Spec2 and the standard Spec both? #43

Closed mosop closed 8 years ago

mosop commented 8 years ago

Hi. I recently started to write some reusable testing codes for Crystal. I want my code to conform to be able to run with Spec and Spec2 both. However, it's a bit hard to test for both Spec and Spec2 on Travis. Because the standard Spec pollutes the Object class and the top level namespace, both Spec and Spec2 can't exist together in a single test process. This problem is not only for Spec2, but I would like you to tell me any advice If you could. Thank you.

mosop commented 8 years ago

For now, I intend to resolve it with the branches settings in travis.yml making dedicated branches for each test library.

waterlink commented 8 years ago

You could have two entry point files for specs: spec2_all_spec.cr and spec_all_spec.cr. You import there everything you need and run then with crystal run.

mosop commented 8 years ago

Yes, I think your approach goes well locally, but not on travis. As I know, there's no way to pass a target file to the build script :(. Anyway, thank you very much for your kindness!

mosop commented 8 years ago

And let me close this issue for now. Thanks!