[rspec-users] inverse examples? (should fail)
dchelimsky at gmail.com
Sat Jun 23 12:47:37 EDT 2007
On 6/23/07, Chris Anderson <jchris at mfdz.com> wrote:
> The new "pending" example feature reminds me of a feature I've been
> bouncing around in my head, to aid in refactoring. Often, when I'm
> changing existing behaviour, I know that certain aspects of the old
> behaviour should change. Imagine changing the "it" method to perhaps
> "not" or "old" or "removed"... The behaviour would be to raise a spec
> error if the example DOES NOT fail. So if
> it "should do something that's been deprecated" do
> passes, than
> old "should do something that's been deprecated" do
> ought to fail.
> It seems like this might be a good first line of defense when starting
> a big refactor.
> I'm not sure about the wording - maybe there's a better way of
> expressing it - perhaps as a second argument to the spec (but that
> would be a little less fun to pepper throughout a document).
> it "should do something that's been deprecated", :inverse => true do
> Thoughts? Does this exist already and I haven't noticed it?
It doesn't exist in rspec, but something like it does in rspec_ext:
I haven't used that, so I don't know if it works with the latest
version or not, but you can give it a shot.
As for including this in rspec, I'm not really understanding it's
value. How would saying something should fail, and failing it if it
doesn't, help you (unless you're writing another behaviour definition
framework ;) )?
> Chris Anderson
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users