rails / rails-dom-testing

Extracting DomAssertions and SelectorAssertions from ActionView.
MIT License
175 stars 57 forks source link

Expand Substitution Matching Types support #90

Closed seanpdoyle closed 3 years ago

seanpdoyle commented 3 years ago

Add substitution support for Symbol and Numeric. It can be convenient to pass in the value of an ActiveRecord::Base#id, or a Symbol declared elsewhere in the test.

kaspth commented 3 years ago

Dig it! Is there someplace we need to update the documentation too?

This was some of the first Rails related code I wrote way back in 2013 and now I shudder that I didn't just fix [id=?] instead of that :match('id', ?) monstrosity 😂

seanpdoyle commented 3 years ago

@kaspth great question!

This repository seems light on documentation. I can't find any mention of substitutions in assertions in the README, and the link back to Rails is for the 4.2 release.

Is there somewhere in Rails that mentions substitutions?

kaspth commented 3 years ago

It's documented here, it seems https://github.com/rails/rails-dom-testing/blob/1cfcd00969eff3d60961084a08633c65f36a460a/lib/rails/dom/testing/assertions/selector_assertions.rb#L104

kaspth commented 3 years ago

Yes, that's it!