Skip to content

Conversation

@kaspth
Copy link
Contributor

@kaspth kaspth commented Aug 22, 2014

Fixes #9.

Possible solution: scope substitutions, so only the question marks within :match() get substituted.

@rafaelfranca
Copy link
Member

Is ? the old format of assertion?

@rafaelfranca
Copy link
Member

Actually it says that the selector have to start with # and have any letter or a ? on it.

#foobar? matches

@kaspth
Copy link
Contributor Author

kaspth commented Aug 22, 2014

Right. I'm starting to doubt if this would have passed on the old sanitizer.

@rafaelfranca
Copy link
Member

Try it on the old one.

@kaspth
Copy link
Contributor Author

kaspth commented Aug 22, 2014

I can't get it to run because of more dependency issues...

@rafaelfranca
Copy link
Member

Test in a older version of Rails.
On Aug 22, 2014 11:37 AM, "Kasper Timm Hansen" notifications@github.com
wrote:

I can't get it to run because of more dependency issues...


Reply to this email directly or view it on GitHub
#11 (comment)
.

@kaspth
Copy link
Contributor Author

kaspth commented Aug 22, 2014

Yep, it works on an earlier Rails version.

@kaspth
Copy link
Contributor Author

kaspth commented Aug 22, 2014

I know why this happens now. The substitution happens before checking what kind of equality checking we're doing.
https://github.com/rails/rails-dom-testing/blob/master/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#L11-L13

The substitution then swallows the extra arguments: https://github.com/rails/rails-dom-testing/blob/master/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#L62

I'm not exactly what the correct way to handle this is. assert_select has some crazy argument determination.

@kaspth
Copy link
Contributor Author

kaspth commented Aug 22, 2014

Maybe the fix would be as simple as only substitute values when they're argument is either a string or a regex.

kaspth added 3 commits August 27, 2014 10:29
- Reorder methods so public interface is more clear
- Make methods private
- Don't allow substitute to be changed
kaspth added a commit that referenced this pull request Aug 27, 2014
Fix #9: Substitution context replaces `?` with false.
@kaspth kaspth merged commit 75a81e5 into master Aug 27, 2014
@kaspth kaspth deleted the fix-false-substitution branch August 27, 2014 08:51
@rafaelfranca
Copy link
Member

❤️ 💚 💙 💛 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Assert absence does not work properly on selectors containing '?'

3 participants