[rspec-users] assert_select - to do negative tests - need help with syntax please :)

David Chelimsky dchelimsky at gmail.com
Fri Oct 14 08:26:10 EDT 2011


On Oct 13, 2011, at 8:56 PM, Gordon wrote:

>> I don't know if you can. Maybe somebody on the Rails list knows.
> 
> If it can't, it means that people can't use assert_select to expect
> NOT to find a given element with extra attributes (such as :name)
> being defined. If that's the case, i think assert_select was either
> poorly written OR not completed yet. It's like saying that "if"
> conditional works but "if not" only works to a simple extend only :( I
> am sure it can be done.
> Can someone please show us how?

This is the main benefit of should and should_not vs assertions. Virtually every matcher works in with both should and should_not (unless it's author explicitly makes it not work that way).

Again, assert_select is part of the Rails library, not RSpec. Please post this question to http://groups.google.com/group/rubyonrails-talk and I'm sure you'll find someone who uses assert_select and can either help you figure out how to do this, or help you work towards making it work better.

Cheers,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20111014/e7708c44/attachment.html>


More information about the rspec-users mailing list