Closed lpil closed 8 years ago
Thank you for questions :)
I'm checking ExSpec
and ShouldI
sources.
Both framework depend on ExUnit
so maybe it is possible.
But there is no easy way to use PowerAssert
, working a lot to import PowerAssert.Assertion.assert
instead of ExUnit.Assertions.assert
.
It may be helpful PowerAssert.AssertionEraser
code to except ExUnit.Assertions.assert
.
https://github.com/ma2gedev/power_assert_ex/blob/1eeed55fd67830b02c0b0404dbb2c38cd3014d56/lib/power_assert/assertion_eraser.ex#L4
Can I just export it as power_assert
or something instead of overriding assert
?
It's nice idea!
I created tiny sample using with ExSpec
.
https://gist.github.com/ma2gedev/b0ad5fb1c81c5804d1d6
Test code uses passert
method wrapping PowerAssert.Assertion.assert
and worked correctly.
Maybe work with ShouldI
though i didn't try with ShouldI
.
I think it would be nice if the README documented how to use just the new assert macro in ExUnit, and then people can work it out from there. It would be nice if it were as simple as use
ing a module.
power_assert
seems like a long name, and passert
doesn't seem very elixir-y. What ought it be called? assert!
?
Thank you for feedback :smiley: I wrote document and commited options to avoid conflict problem.
The name of new macro is power_assert
though it is long name.
Document is here. https://github.com/ma2gedev/power_assert_ex#how-to-use-other-framework-depending-on-exunit-such-as-exspec
Also published version 0.0.4 included this option to hex.
Thanks!
@lpil
Currently it is possible to use the PowerAssert assert
with ExSpec and ShouldI.
This is available after PowerAssertEx version 0.0.8.
If you still are interested in power assert, please try it.
If you use ExSpec, see this section. Or ShouldI, see this section.
Sample code is here: With ExSpec With ShouldI
Thanks!!
I'm actually migrating to ExUnit, but thank you :)
Thanks for you comment. Also thank you opened this issue, now i understood certainly about import
's except
option behavior.
:bow:
Fantastic :D
Thanks :)