Skip to content

Commit d45c3ab

Browse files
rafaelfrancakaspth
authored andcommitted
Merge pull request rails#19502 from kaspth/assert-select-failure-output
[ci skip] Update 4.2 Release notes with more assert_select information.
1 parent 9dc5311 commit d45c3ab

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

guides/source/4_2_release_notes.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,30 @@ application is using any of these spellings, you will need to update them:
300300
assert_select('p', 'AT&T') # => false
301301
```
302302
303+
Furthermore substitutions have changed syntax.
304+
305+
Now you have to use a `:match` CSS-like selector:
306+
307+
```ruby
308+
assert_select ":match('id', ?)", 'comment_1'
309+
```
310+
311+
Additionally Regexp substitutions look different when the assertion fails.
312+
Notice how `/hello/` here:
313+
314+
```ruby
315+
assert_select(":match('id', ?)", /hello/)
316+
```
317+
318+
becomes `"(?-mix:hello)"`:
319+
320+
```
321+
Expected at least 1 element matching "div:match('id', "(?-mix:hello)")", found 0..
322+
Expected 0 to be >= 1.
323+
```
324+
325+
See the [Rails Dom Testing](https://github.com/rails/rails-dom-testing/tree/8798b9349fb9540ad8cb9a0ce6cb88d1384a210b) documentation for more on `assert_select`.
326+
303327

304328
Railties
305329
--------

0 commit comments

Comments
 (0)