Commit 6b25d24
committed
Fix multi-step jump for months of different length
Whenever we'd travel more than one month into the future or into the
past in a test fixture, the day of month would end up being that of the
shortest month in between start and end month. For example, if the
current date was '2019-03-29', then jumping two months back would yield
'2019-01-28' instead of '2019-01-29' because February only has 28 days
in 2019. This would lead to unexpected results in test fixtures.
This commit fixes the issue by removing the timetravel() method and
replacing it with native calls to Ruby's :next_month or :prev_month
which, surprisingly, can take arguments, e.g. :next_month(2) to jump two
months forward, rendering the timetravel() method obsolete.1 parent 0cbd7f6 commit 6b25d24
File tree
2 files changed
+42
-14
lines changed- lib/squcumber-postgres/support
- spec/squcumber-postgres/support
2 files changed
+42
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
| |||
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
64 | | - | |
| 62 | + | |
65 | 63 | | |
66 | | - | |
| 64 | + | |
67 | 65 | | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | | - | |
| 68 | + | |
71 | 69 | | |
72 | | - | |
| 70 | + | |
73 | 71 | | |
74 | | - | |
| 72 | + | |
75 | 73 | | |
76 | 74 | | |
77 | | - | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | 83 | | |
86 | | - | |
| 84 | + | |
87 | 85 | | |
88 | 86 | | |
89 | | - | |
| 87 | + | |
90 | 88 | | |
91 | 89 | | |
92 | | - | |
| 90 | + | |
93 | 91 | | |
94 | 92 | | |
95 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
47 | 77 | | |
48 | 78 | | |
49 | 79 | | |
| |||
0 commit comments