Commit fa4c9d5
authored
Improve validate_inclusion_of matcher boolean warn messages (#1692)
Closes #1688
The generated warn messages for the validate_inclusion_of matcher do not include
the model/attribute names, which makes it hard to know where
to look at to update/remove the tests.
Following the library's existing warn messages behaviour
of including the attribute in the message, I did the same here.
I believe this is a simple but helpful improvement to help
users fix those warnings. For example: https://github.com/thoughtbot/shoulda-matchers/blob/main/lib/shoulda/matchers/active_model/errors.rb#L17
I did consider adding the line/caller location, but I didn't
find an example of that in the library, and decided to propose
simply adding the model#attribute names.1 parent c0b8352 commit fa4c9d5
File tree
2 files changed
+26
-22
lines changed- lib/shoulda/matchers/active_model
- spec/unit/shoulda/matchers/active_model
2 files changed
+26
-22
lines changedLines changed: 22 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 281 | | |
294 | 282 | | |
295 | 283 | | |
| |||
400 | 388 | | |
401 | 389 | | |
402 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
403 | 409 | | |
404 | 410 | | |
405 | 411 | | |
| |||
492 | 498 | | |
493 | 499 | | |
494 | 500 | | |
495 | | - | |
| 501 | + | |
496 | 502 | | |
497 | 503 | | |
498 | 504 | | |
499 | | - | |
| 505 | + | |
500 | 506 | | |
501 | 507 | | |
502 | 508 | | |
| |||
513 | 519 | | |
514 | 520 | | |
515 | 521 | | |
516 | | - | |
| 522 | + | |
517 | 523 | | |
518 | 524 | | |
519 | 525 | | |
520 | | - | |
| 526 | + | |
521 | 527 | | |
522 | 528 | | |
523 | 529 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
| 693 | + | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
698 | | - | |
| 697 | + | |
699 | 698 | | |
700 | 699 | | |
701 | 700 | | |
| |||
750 | 749 | | |
751 | 750 | | |
752 | 751 | | |
753 | | - | |
| 752 | + | |
754 | 753 | | |
755 | 754 | | |
756 | 755 | | |
757 | | - | |
758 | | - | |
| 756 | + | |
759 | 757 | | |
760 | 758 | | |
761 | 759 | | |
| |||
0 commit comments