Re: [wrong] Integration bug with RSpec: can't alias :expect, :assert (#6)

3 views
Skip to first unread message

Alex Chaffee

unread,
May 15, 2011, 10:59:34 AM5/15/11
to wron...@googlegroups.com, David Chelimsky, Steve Conover
Yikes! Thanks for finding this. Tests that always pass are even worse than tests that always fail!

I'll update the readme right away. As for the fix, let me think about it once I've had a bit more coffee :-). I think that the simple configuration option is probably best. Except for this name collision, Wrong is pretty much invisible to RSpec, and it may be overkill to make a whole pluggable library system for something that already (nearly) works fine with a require.

 - A

On Sun, May 15, 2011 at 7:43 AM, dchelimsky <reply+i-902557-0e7572ea6bd9...@reply.github.com> wrote:
The [README](https://github.com/sconover/wrong/blob/master/README.markdown) says you can alias `assert` with `expect` when using RSpec. This actually doesn't work because rspec-expectations already defines `expect` (as an alias for `lambda`). The outcome is that all examples pass whether they should or not.

RSpec recently added a hook to configure the assertion/expectation library to be either rspec-expectations, stdlib (t/u assertions on 1.8, minitest assertion on 1.9), or both. I tried setting this to use stdlib so rspec-expectations wouldn't be loaded (and define `expect`, but then there were errors because `wrong` assigns `failure_class` the value `RSpec::Expectations::ExpectationNotMetError`, which lives (as its name suggests) in rspec-expectations.

Since this isn' t working as advertised, it'd be great if you changed the README to exclude the bit about aliasing `assert` with `expect`.

Once that's done, I'd like to get this working and am happy to collaborate with you to do so. The question is what belongs where? One possibility is for RSpec to expose a configuration option that turns off the `lambda`, `expect` alias. Another is for RSpec to expose a better extension point for this sort of integration - something like the [mock framework adapters](http://relishapp.com/rspec/rspec-core/v/2-6/dir/mock-framework-integration/mock-with-an-alternative-framework). I'm sure there are several other approaches we could take.

WDYT?

--
Reply to this email directly or view it on GitHub:
https://github.com/sconover/wrong/issues/6



--

Alex Chaffee - al...@cohuman.com - http://alexch.github.com
Stalk me: http://friendfeed.com/alexch | http://twitter.com/alexch | http://alexch.tumblr.com
Reply all
Reply to author
Forward
0 new messages