0003-Replace-to_s-db-to-to_fs-db.patch

Takashi Kato, 2022-04-10 15:35

Download (10.9 KB)

View differences:

test/fixtures/issues.yml
1 1
---
2 2
issues_001:
3
  created_on: <%= 3.days.ago.to_s(:db) %>
3
  created_on: <%= 3.days.ago.to_fs(:db) %>
4 4
  project_id: 1
5
  updated_on: <%= 1.day.ago.to_s(:db) %>
5
  updated_on: <%= 1.day.ago.to_fs(:db) %>
6 6
  priority_id: 4
7 7
  subject: Cannot print recipes
8 8
  id: 1
......
13 13
  assigned_to_id:
14 14
  author_id: 2
15 15
  status_id: 1
16
  start_date: <%= 1.day.ago.to_date.to_s(:db) %>
17
  due_date: <%= 10.day.from_now.to_date.to_s(:db) %>
16
  start_date: <%= 1.day.ago.to_date.to_fs(:db) %>
17
  due_date: <%= 10.day.from_now.to_date.to_fs(:db) %>
18 18
  estimated_hours: 200.0
19 19
  root_id: 1
20 20
  lft: 1
......
34 34
  assigned_to_id: 3
35 35
  author_id: 2
36 36
  status_id: 2
37
  start_date: <%= 2.day.ago.to_date.to_s(:db) %>
37
  start_date: <%= 2.day.ago.to_date.to_fs(:db) %>
38 38
  due_date:
39 39
  estimated_hours: 0.5
40 40
  root_id: 2
......
56 56
  assigned_to_id: 3
57 57
  author_id: 2
58 58
  status_id: 1
59
  start_date: <%= 15.day.ago.to_date.to_s(:db) %>
60
  due_date: <%= 5.day.ago.to_date.to_s(:db) %>
59
  start_date: <%= 15.day.ago.to_date.to_fs(:db) %>
60
  due_date: <%= 5.day.ago.to_date.to_fs(:db) %>
61 61
  estimated_hours: 1.0
62 62
  root_id: 3
63 63
  lft: 1
64 64
  rgt: 2
65 65
issues_004:
66
  created_on: <%= 5.days.ago.to_s(:db) %>
66
  created_on: <%= 5.days.ago.to_fs(:db) %>
67 67
  project_id: 2
68
  updated_on: <%= 2.days.ago.to_s(:db) %>
68
  updated_on: <%= 2.days.ago.to_fs(:db) %>
69 69
  priority_id: 4
70 70
  subject: Issue on project 2
71 71
  id: 4
......
80 80
  lft: 1
81 81
  rgt: 2
82 82
issues_005:
83
  created_on: <%= 5.days.ago.to_s(:db) %>
83
  created_on: <%= 5.days.ago.to_fs(:db) %>
84 84
  project_id: 3
85
  updated_on: <%= 2.days.ago.to_s(:db) %>
85
  updated_on: <%= 2.days.ago.to_fs(:db) %>
86 86
  priority_id: 4
87 87
  subject: Subproject issue
88 88
  id: 5
......
98 98
  lft: 1
99 99
  rgt: 2
100 100
issues_006:
101
  created_on: <%= 1.minute.ago.to_s(:db) %>
101
  created_on: <%= 1.minute.ago.to_fs(:db) %>
102 102
  project_id: 5
103
  updated_on: <%= 1.minute.ago.to_s(:db) %>
103
  updated_on: <%= 1.minute.ago.to_fs(:db) %>
104 104
  priority_id: 4
105 105
  subject: Issue of a private subproject
106 106
  id: 6
......
111 111
  assigned_to_id:
112 112
  author_id: 2
113 113
  status_id: 1
114
  start_date: <%= Date.today.to_s(:db) %>
115
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
114
  start_date: <%= Date.today.to_fs(:db) %>
115
  due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>
116 116
  root_id: 6
117 117
  lft: 1
118 118
  rgt: 2
119 119
issues_007:
120
  created_on: <%= 10.days.ago.to_s(:db) %>
120
  created_on: <%= 10.days.ago.to_fs(:db) %>
121 121
  project_id: 1
122
  updated_on: <%= 10.days.ago.to_s(:db) %>
122
  updated_on: <%= 10.days.ago.to_fs(:db) %>
123 123
  priority_id: 5
124 124
  subject: Issue due today
125 125
  id: 7
......
130 130
  assigned_to_id:
131 131
  author_id: 2
132 132
  status_id: 1
133
  start_date: <%= 10.days.ago.to_s(:db) %>
134
  due_date: <%= Date.today.to_s(:db) %>
133
  start_date: <%= 10.days.ago.to_fs(:db) %>
134
  due_date: <%= Date.today.to_fs(:db) %>
135 135
  lock_version: 0
136 136
  root_id: 7
137 137
  lft: 1
138 138
  rgt: 2
139 139
issues_008:
140
  created_on: <%= 10.days.ago.to_s(:db) %>
140
  created_on: <%= 10.days.ago.to_fs(:db) %>
141 141
  project_id: 1
142
  updated_on: <%= 10.days.ago.to_s(:db) %>
142
  updated_on: <%= 10.days.ago.to_fs(:db) %>
143 143
  priority_id: 5
144 144
  subject: Closed issue
145 145
  id: 8
......
156 156
  root_id: 8
157 157
  lft: 1
158 158
  rgt: 2
159
  closed_on: <%= 3.days.ago.to_s(:db) %>
159
  closed_on: <%= 3.days.ago.to_fs(:db) %>
160 160
issues_009:
161
  created_on: <%= 1.minute.ago.to_s(:db) %>
161
  created_on: <%= 1.minute.ago.to_fs(:db) %>
162 162
  project_id: 5
163
  updated_on: <%= 1.minute.ago.to_s(:db) %>
163
  updated_on: <%= 1.minute.ago.to_fs(:db) %>
164 164
  priority_id: 5
165 165
  subject: Blocked Issue
166 166
  id: 9
......
171 171
  assigned_to_id:
172 172
  author_id: 2
173 173
  status_id: 1
174
  start_date: <%= Date.today.to_s(:db) %>
175
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
174
  start_date: <%= Date.today.to_fs(:db) %>
175
  due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>
176 176
  root_id: 9
177 177
  lft: 1
178 178
  rgt: 2
179 179
issues_010:
180
  created_on: <%= 1.minute.ago.to_s(:db) %>
180
  created_on: <%= 1.minute.ago.to_fs(:db) %>
181 181
  project_id: 5
182
  updated_on: <%= 1.minute.ago.to_s(:db) %>
182
  updated_on: <%= 1.minute.ago.to_fs(:db) %>
183 183
  priority_id: 5
184 184
  subject: Issue Doing the Blocking
185 185
  id: 10
......
190 190
  assigned_to_id:
191 191
  author_id: 2
192 192
  status_id: 1
193
  start_date: <%= Date.today.to_s(:db) %>
194
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
193
  start_date: <%= Date.today.to_fs(:db) %>
194
  due_date: <%= 1.days.from_now.to_date.to_fs(:db) %>
195 195
  root_id: 10
196 196
  lft: 1
197 197
  rgt: 2
198 198
issues_011:
199
  created_on: <%= 3.days.ago.to_s(:db) %>
199
  created_on: <%= 3.days.ago.to_fs(:db) %>
200 200
  project_id: 1
201
  updated_on: <%= 1.day.ago.to_s(:db) %>
201
  updated_on: <%= 1.day.ago.to_fs(:db) %>
202 202
  priority_id: 5
203 203
  subject: Closed issue on a closed version
204 204
  id: 11
......
209 209
  assigned_to_id:
210 210
  author_id: 2
211 211
  status_id: 5
212
  start_date: <%= 1.day.ago.to_date.to_s(:db) %>
212
  start_date: <%= 1.day.ago.to_date.to_fs(:db) %>
213 213
  due_date:
214 214
  root_id: 11
215 215
  lft: 1
216 216
  rgt: 2
217
  closed_on: <%= 1.day.ago.to_s(:db) %>
217
  closed_on: <%= 1.day.ago.to_fs(:db) %>
218 218
issues_012:
219
  created_on: <%= 3.days.ago.to_s(:db) %>
219
  created_on: <%= 3.days.ago.to_fs(:db) %>
220 220
  project_id: 1
221
  updated_on: <%= 1.day.ago.to_s(:db) %>
221
  updated_on: <%= 1.day.ago.to_fs(:db) %>
222 222
  priority_id: 5
223 223
  subject: Closed issue on a locked version
224 224
  id: 12
......
229 229
  assigned_to_id:
230 230
  author_id: 3
231 231
  status_id: 5
232
  start_date: <%= 1.day.ago.to_date.to_s(:db) %>
232
  start_date: <%= 1.day.ago.to_date.to_fs(:db) %>
233 233
  due_date:
234 234
  root_id: 12
235 235
  lft: 1
236 236
  rgt: 2
237
  closed_on: <%= 1.day.ago.to_s(:db) %>
237
  closed_on: <%= 1.day.ago.to_fs(:db) %>
238 238
issues_013:
239
  created_on: <%= 5.days.ago.to_s(:db) %>
239
  created_on: <%= 5.days.ago.to_fs(:db) %>
240 240
  project_id: 3
241
  updated_on: <%= 2.days.ago.to_s(:db) %>
241
  updated_on: <%= 2.days.ago.to_fs(:db) %>
242 242
  priority_id: 4
243 243
  subject: Subproject issue two
244 244
  id: 13
......
254 254
  rgt: 2
255 255
issues_014:
256 256
  id: 14
257
  created_on: <%= 15.days.ago.to_s(:db) %>
257
  created_on: <%= 15.days.ago.to_fs(:db) %>
258 258
  project_id: 3
259
  updated_on: <%= 15.days.ago.to_s(:db) %>
259
  updated_on: <%= 15.days.ago.to_fs(:db) %>
260 260
  priority_id: 5
261 261
  subject: Private issue on public project
262 262
  fixed_version_id:
test/fixtures/journals.yml
1 1
---
2 2
journals_001:
3
  created_on: <%= 2.days.ago.to_date.to_s(:db) %>
3
  created_on: <%= 2.days.ago.to_date.to_fs(:db) %>
4 4
  notes: "Journal notes"
5 5
  id: 1
6 6
  journalized_type: Issue
7 7
  user_id: 1
8 8
  journalized_id: 1
9 9
journals_002:
10
  created_on: <%= 1.days.ago.to_date.to_s(:db) %>
10
  created_on: <%= 1.days.ago.to_date.to_fs(:db) %>
11 11
  notes: "Some notes with Redmine links: #2, r2."
12 12
  id: 2
13 13
  journalized_type: Issue
14 14
  user_id: 2
15 15
  journalized_id: 1
16 16
journals_003:
17
  created_on: <%= 1.days.ago.to_date.to_s(:db) %>
17
  created_on: <%= 1.days.ago.to_date.to_fs(:db) %>
18 18
  notes: "A comment with inline image: !picture.jpg! and a reference to #1 and r2."
19 19
  id: 3
20 20
  journalized_type: Issue
21 21
  user_id: 2
22 22
  journalized_id: 2
23 23
journals_004:
24
  created_on: <%= 1.days.ago.to_date.to_s(:db) %>
24
  created_on: <%= 1.days.ago.to_date.to_fs(:db) %>
25 25
  notes: "A comment with a private version."
26 26
  id: 4
27 27
  journalized_type: Issue
......
29 29
  journalized_id: 6
30 30
journals_005:
31 31
  id: 5
32
  created_on: <%= 1.days.ago.to_date.to_s(:db) %>
32
  created_on: <%= 1.days.ago.to_date.to_fs(:db) %>
33 33
  notes: "A comment on a private issue."
34 34
  user_id: 2
35 35
  journalized_type: Issue
test/fixtures/messages.yml
45 45
  parent_id: 
46 46
  board_id: 1
47 47
messages_005: 
48
  created_on: <%= 3.days.ago.to_date.to_s(:db) %>
49
  updated_on: <%= 3.days.ago.to_date.to_s(:db) %>
48
  created_on: <%= 3.days.ago.to_date.to_fs(:db) %>
49
  updated_on: <%= 3.days.ago.to_date.to_fs(:db) %>
50 50
  subject: 'RE: post 2'
51 51
  id: 5
52 52
  replies_count: 0
......
56 56
  parent_id: 4
57 57
  board_id: 1
58 58
messages_006: 
59
  created_on: <%= 2.days.ago.to_date.to_s(:db) %>
60
  updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
59
  created_on: <%= 2.days.ago.to_date.to_fs(:db) %>
60
  updated_on: <%= 2.days.ago.to_date.to_fs(:db) %>
61 61
  subject: 'RE: post 2'
62 62
  id: 6
63 63
  replies_count: 0
......
67 67
  parent_id: 4
68 68
  board_id: 1
69 69
messages_007: 
70
  created_on: <%= 2.days.ago.to_date.to_s(:db) %>
71
  updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
70
  created_on: <%= 2.days.ago.to_date.to_fs(:db) %>
71
  updated_on: <%= 2.days.ago.to_date.to_fs(:db) %>
72 72
  subject: 'Message on a private project'
73 73
  id: 7
74 74
  replies_count: 0
test/fixtures/versions.yml
16 16
  updated_on: 2006-07-19 21:00:33 +02:00
17 17
  id: 2
18 18
  description: Stable release
19
  effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
19
  effective_date: <%= 20.day.from_now.to_date.to_fs(:db) %>
20 20
  status: locked
21 21
  sharing: 'none'
22 22
  wiki_page_title: ECookBookV1
test/unit/query_test.rb
1209 1209
    query = IssueQuery.new(:name => '_')
1210 1210
    filter_name = "fixed_version.due_date"
1211 1211
    assert_include filter_name, query.available_filters.keys
1212
    query.filters = {filter_name => {:operator => '=', :values => [20.day.from_now.to_date.to_s(:db)]}}
1212
    query.filters = {filter_name => {:operator => '=', :values => [20.day.from_now.to_date.to_fs(:db)]}}
1213 1213
    issues = find_issues_with_query(query)
1214 1214
    assert_equal [2], issues.map(&:fixed_version_id).uniq.sort
1215 1215
    assert_equal [2, 12], issues.map(&:id).sort
1216 1216

  
1217 1217
    query = IssueQuery.new(:name => '_')
1218
    query.filters = {filter_name => {:operator => '>=', :values => [21.day.from_now.to_date.to_s(:db)]}}
1218
    query.filters = {filter_name => {:operator => '>=', :values => [21.day.from_now.to_date.to_fs(:db)]}}
1219 1219
    assert_equal 0, find_issues_with_query(query).size
1220 1220
  end
1221 1221

  
1222
-