-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature | Introduce assert_not_dom
and its alias assert_not_select
#112
Comments
@joshuay03 Thanks for suggesting this! I think this would be a nice addition to the API. If you'd be willing to work on this, I would love that! and would definitely welcome the help. Side note: I'd love if we also supported the minitest style of So tell me if this makes sense:
WDYT? |
@flavorjones Thank you for your reply. All that makes sense to me. I'll update here when I've got a PR up 👍🏽 |
I got this up: #113 |
Also, when working on this I realised you can do: assert_select "div", 0 do |matches|
puts "we never get here but I think we should raise an error if given a block in such cases"
end I'll open a separate issue for this. |
#113 has been merged (thanks, @rafaelfranca!) |
There are occasions when you need to assert that there were no specific elements rendered, currently this can be achieved with any of:
One downside of this is that it's not clear until you get to the end of the line that the assertion is for the inverse / lack of. This isn't as much of an issue when using
Integer
,Range
,:count
or:maximum
with positive integers, as the assertion itself is for existence.I'd like to propose introducing
assert_not_dom
and its aliasassert_not_select
which returntrue
if no elements are found ie they are an optional drop in replacement for my examples above:I believe this pattern is consistent with other test helper pairs provided by
ActiveSupport
(assert_not
,assert_not_nil
,assert_no_match
etc.).Some vanity metrics:
assert_not
overassert !
.I would like to work on this if someone can confirm if the feature will be accepted.
The text was updated successfully, but these errors were encountered: