Commit 92cc5ff
Nuno Silva
Improve autocorrect for Capybara/CurrentPathExpectation
`expect(page.current_path).to eq(EXPECTED_VALUE)` is not directly equivalent to `expect(page).to have_current_path(EXPECTED_VALUE)`
In particular, `have_current_path` with no options will include the querystring on the path, while `page.current_path` does not.
This fix ensures the option `ignore_query: true` is set on `have_current_path` expect when `EXPECTED_VALUE` is a string or regexp.
In those cases, it should be safe to not use this param.1 parent b521fb2 commit 92cc5ff
File tree
3 files changed
+41
-4
lines changed- lib/rubocop/cop/rspec/capybara
- spec/rubocop/cop/rspec/capybara
3 files changed
+41
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
446 | 447 | | |
447 | 448 | | |
448 | 449 | | |
| 450 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
| |||
Lines changed: 23 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
35 | 51 | | |
36 | 52 | | |
37 | 53 | | |
38 | | - | |
| 54 | + | |
| 55 | + | |
39 | 56 | | |
40 | 57 | | |
41 | 58 | | |
42 | | - | |
| 59 | + | |
| 60 | + | |
43 | 61 | | |
44 | 62 | | |
45 | 63 | | |
46 | | - | |
| 64 | + | |
| 65 | + | |
47 | 66 | | |
48 | 67 | | |
49 | 68 | | |
| |||
0 commit comments