trusty-cms 7.1.3 → 8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +118 -123
  3. data/config/application.rb +5 -1
  4. data/lib/string_extensions/string_extensions.rb +4 -2
  5. data/lib/trusty_cms/version.rb +1 -1
  6. data/spec/controllers/admin/assets_controller_spec.rb +124 -0
  7. data/spec/controllers/admin/changes_controller_spec.rb +72 -0
  8. data/spec/controllers/admin/configuration_controller_spec.rb +49 -0
  9. data/spec/controllers/admin/page_attachments_controller_spec.rb +54 -0
  10. data/spec/controllers/admin/pages_controller_spec.rb +162 -0
  11. data/spec/controllers/admin/preferences_controller_spec.rb +44 -0
  12. data/spec/controllers/admin/security_controller_spec.rb +85 -0
  13. data/spec/controllers/admin/sessions_controller_spec.rb +56 -0
  14. data/spec/controllers/admin/two_factor_controller_spec.rb +63 -0
  15. data/spec/controllers/admin/users_controller_spec.rb +132 -0
  16. data/spec/controllers/page_status_controller_spec.rb +66 -0
  17. data/spec/dummy/bin/rails +3 -3
  18. data/spec/dummy/bin/rake +2 -2
  19. data/spec/dummy/bin/setup +21 -13
  20. data/spec/dummy/config/application.rb +2 -0
  21. data/spec/dummy/config/boot.rb +1 -1
  22. data/spec/dummy/config/cable.yml +10 -0
  23. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  24. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -2
  25. data/spec/dummy/config/initializers/inflections.rb +4 -4
  26. data/spec/dummy/config/initializers/new_framework_defaults_7_2.rb +70 -0
  27. data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
  28. data/spec/dummy/config/puma.rb +34 -0
  29. data/spec/dummy/config/storage.yml +28 -1
  30. data/spec/dummy/db/migrate/20260729201444_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
  31. data/spec/dummy/db/migrate/20260729201445_create_active_storage_variant_records.active_storage.rb +27 -0
  32. data/spec/dummy/db/migrate/20260729201446_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +8 -0
  33. data/spec/dummy/public/404.html +6 -6
  34. data/spec/dummy/public/406-unsupported-browser.html +66 -0
  35. data/spec/dummy/public/422.html +6 -6
  36. data/spec/dummy/public/500.html +6 -6
  37. data/spec/dummy/public/icon.png +0 -0
  38. data/spec/dummy/public/icon.svg +3 -0
  39. data/spec/dummy/public/robots.txt +1 -0
  40. data/spec/helpers/admin/configuration_helper_spec.rb +62 -0
  41. data/spec/helpers/admin/node_helper_spec.rb +132 -0
  42. data/spec/helpers/admin/pages_helper_spec.rb +84 -0
  43. data/spec/helpers/application_helper_spec.rb +115 -0
  44. data/spec/lib/string_extensions_spec.rb +41 -0
  45. data/spec/support/active_record_encryption.rb +10 -0
  46. data/spec/support/asset_type_registry.rb +29 -0
  47. data/trusty_cms.gemspec +2 -1
  48. metadata +74 -6
  49. data/spec/controllers/assets_controller.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f50633a419203ee6b0b6e35814de7af711b70dd362d5fe0f712543d31f1fc75
4
- data.tar.gz: f5ccf44bd927e9a392e9979388c9d6f65ace4c1f965516d64936ee1da5e50d53
3
+ metadata.gz: 77d3850c23f30e1a9654c68e84bf5f34c3c7ebd3f0deaf5baadd91a34423eb3f
4
+ data.tar.gz: d21af2702b713670e01cd1f33ae95e8d2ea9803e1134921a8d76f90e2d75ec0d
5
5
  SHA512:
6
- metadata.gz: 8324822cde6d47651420dc28038f51e629e1b411c276a0ddded87dac9587a571de5218e36452f929d0e5c55c4106aa47a21cf72f14e06c78b545c849cfafed6a
7
- data.tar.gz: 4e4dc362cd53e8124eaba08331db95eb085fe28b8778776ceef121a7e3b993f379b26d2c56c17538962adca2e2b47eb0e834c16d6f67f4a45b4a6cbab9a33cb3
6
+ metadata.gz: 4847f7ef1367b73749feead54eae6d0c7ffa76d953b6ac6dd0c29af23cdfe11b0b4c9a26e8a9018b0d0200ae30818f65cb6aba4be1bc3e41a5e4c4089ac0cd0f
7
+ data.tar.gz: bdd09ed13ebc928624962d5d44b0eb82d63694a55a9fbcd5b50584a206ae998c81f5f68353c97738cb0a1e6c84f2fe158cb222bd37f22c3798f932f6346fbc07
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (7.1.3)
4
+ trusty-cms (8.0)
5
5
  RedCloth (= 4.3.4)
6
6
  activestorage-validator
7
7
  acts_as_list (>= 0.9.5, < 1.3.0)
@@ -20,6 +20,7 @@ PATH
20
20
  highline (>= 1.7.8, < 3.2.0)
21
21
  image_processing
22
22
  kraken-io
23
+ mini_magick (~> 5.0)
23
24
  mini_racer
24
25
  mutex_m
25
26
  mysql2
@@ -29,7 +30,7 @@ PATH
29
30
  rack (>= 2.0.1, < 3.2.0)
30
31
  rack-cache (~> 1.7)
31
32
  radius (~> 0.8)
32
- rails (~> 7.2.2.1)
33
+ rails (~> 8.0.0)
33
34
  rake (< 14.0)
34
35
  ransack (~> 4.2.1)
35
36
  rdoc (>= 5.1, < 9.0)
@@ -46,68 +47,67 @@ GEM
46
47
  remote: https://rubygems.org/
47
48
  specs:
48
49
  RedCloth (4.3.4)
49
- actioncable (7.2.2.1)
50
- actionpack (= 7.2.2.1)
51
- activesupport (= 7.2.2.1)
50
+ actioncable (8.0.5.1)
51
+ actionpack (= 8.0.5.1)
52
+ activesupport (= 8.0.5.1)
52
53
  nio4r (~> 2.0)
53
54
  websocket-driver (>= 0.6.1)
54
55
  zeitwerk (~> 2.6)
55
- actionmailbox (7.2.2.1)
56
- actionpack (= 7.2.2.1)
57
- activejob (= 7.2.2.1)
58
- activerecord (= 7.2.2.1)
59
- activestorage (= 7.2.2.1)
60
- activesupport (= 7.2.2.1)
56
+ actionmailbox (8.0.5.1)
57
+ actionpack (= 8.0.5.1)
58
+ activejob (= 8.0.5.1)
59
+ activerecord (= 8.0.5.1)
60
+ activestorage (= 8.0.5.1)
61
+ activesupport (= 8.0.5.1)
61
62
  mail (>= 2.8.0)
62
- actionmailer (7.2.2.1)
63
- actionpack (= 7.2.2.1)
64
- actionview (= 7.2.2.1)
65
- activejob (= 7.2.2.1)
66
- activesupport (= 7.2.2.1)
63
+ actionmailer (8.0.5.1)
64
+ actionpack (= 8.0.5.1)
65
+ actionview (= 8.0.5.1)
66
+ activejob (= 8.0.5.1)
67
+ activesupport (= 8.0.5.1)
67
68
  mail (>= 2.8.0)
68
69
  rails-dom-testing (~> 2.2)
69
- actionpack (7.2.2.1)
70
- actionview (= 7.2.2.1)
71
- activesupport (= 7.2.2.1)
70
+ actionpack (8.0.5.1)
71
+ actionview (= 8.0.5.1)
72
+ activesupport (= 8.0.5.1)
72
73
  nokogiri (>= 1.8.5)
73
- racc
74
- rack (>= 2.2.4, < 3.2)
74
+ rack (>= 2.2.4)
75
75
  rack-session (>= 1.0.1)
76
76
  rack-test (>= 0.6.3)
77
77
  rails-dom-testing (~> 2.2)
78
78
  rails-html-sanitizer (~> 1.6)
79
79
  useragent (~> 0.16)
80
- actiontext (7.2.2.1)
81
- actionpack (= 7.2.2.1)
82
- activerecord (= 7.2.2.1)
83
- activestorage (= 7.2.2.1)
84
- activesupport (= 7.2.2.1)
80
+ actiontext (8.0.5.1)
81
+ actionpack (= 8.0.5.1)
82
+ activerecord (= 8.0.5.1)
83
+ activestorage (= 8.0.5.1)
84
+ activesupport (= 8.0.5.1)
85
85
  globalid (>= 0.6.0)
86
86
  nokogiri (>= 1.8.5)
87
- actionview (7.2.2.1)
88
- activesupport (= 7.2.2.1)
87
+ actionview (8.0.5.1)
88
+ activesupport (= 8.0.5.1)
89
89
  builder (~> 3.1)
90
90
  erubi (~> 1.11)
91
91
  rails-dom-testing (~> 2.2)
92
92
  rails-html-sanitizer (~> 1.6)
93
- activejob (7.2.2.1)
94
- activesupport (= 7.2.2.1)
93
+ activejob (8.0.5.1)
94
+ activesupport (= 8.0.5.1)
95
95
  globalid (>= 0.3.6)
96
- activemodel (7.2.2.1)
97
- activesupport (= 7.2.2.1)
98
- activerecord (7.2.2.1)
99
- activemodel (= 7.2.2.1)
100
- activesupport (= 7.2.2.1)
96
+ activemodel (8.0.5.1)
97
+ activesupport (= 8.0.5.1)
98
+ activerecord (8.0.5.1)
99
+ activemodel (= 8.0.5.1)
100
+ activesupport (= 8.0.5.1)
101
101
  timeout (>= 0.4.0)
102
- activestorage (7.2.2.1)
103
- actionpack (= 7.2.2.1)
104
- activejob (= 7.2.2.1)
105
- activerecord (= 7.2.2.1)
106
- activesupport (= 7.2.2.1)
102
+ activestorage (8.0.5.1)
103
+ actionpack (= 8.0.5.1)
104
+ activejob (= 8.0.5.1)
105
+ activerecord (= 8.0.5.1)
106
+ activesupport (= 8.0.5.1)
107
107
  marcel (~> 1.0)
108
- activestorage-validator (0.4.0)
109
- rails (>= 6.1.0)
110
- activesupport (7.2.2.1)
108
+ activestorage-validator (0.8.0)
109
+ rails (>= 7.2.0)
110
+ activesupport (8.0.5.1)
111
111
  base64
112
112
  benchmark (>= 0.3)
113
113
  bigdecimal
@@ -119,6 +119,7 @@ GEM
119
119
  minitest (>= 5.1)
120
120
  securerandom (>= 0.3)
121
121
  tzinfo (~> 2.0, >= 2.0.5)
122
+ uri (>= 0.13.1)
122
123
  acts_as_list (1.2.6)
123
124
  activerecord (>= 6.1)
124
125
  activesupport (>= 6.1)
@@ -147,7 +148,7 @@ GEM
147
148
  chunky_png (1.4.0)
148
149
  cliver (0.3.2)
149
150
  coderay (1.1.3)
150
- concurrent-ruby (1.3.7)
151
+ concurrent-ruby (1.3.8)
151
152
  connection_pool (3.0.2)
152
153
  crass (1.0.7)
153
154
  css_parser (3.0.0)
@@ -155,13 +156,13 @@ GEM
155
156
  ssrf_filter (~> 1.5)
156
157
  csso-rails (0.9.0)
157
158
  execjs (>= 1)
158
- csv (3.3.0)
159
+ csv (3.3.6)
159
160
  database_cleaner (2.1.0)
160
161
  database_cleaner-active_record (>= 2, < 3)
161
- database_cleaner-active_record (2.2.0)
162
+ database_cleaner-active_record (2.2.2)
162
163
  activerecord (>= 5.a)
163
- database_cleaner-core (~> 2.0.0)
164
- database_cleaner-core (2.0.1)
164
+ database_cleaner-core (~> 2.0)
165
+ database_cleaner-core (2.1.0)
165
166
  date (3.5.1)
166
167
  delocalize (1.2.0)
167
168
  rails (>= 2)
@@ -178,32 +179,31 @@ GEM
178
179
  rotp (~> 6.0)
179
180
  diff-lcs (1.6.2)
180
181
  diffy (3.4.4)
181
- docile (1.4.1)
182
182
  drb (2.2.3)
183
- erb (6.0.4)
183
+ erb (6.0.6)
184
184
  erubi (1.13.1)
185
- execjs (2.10.0)
185
+ execjs (2.10.1)
186
186
  factory_bot (6.6.0)
187
187
  activesupport (>= 6.1.0)
188
188
  factory_bot_rails (6.5.1)
189
189
  factory_bot (~> 6.5)
190
190
  railties (>= 6.1.0)
191
- ffi (1.17.0-aarch64-linux-gnu)
192
- ffi (1.17.0-aarch64-linux-musl)
193
- ffi (1.17.0-arm-linux-gnu)
194
- ffi (1.17.0-arm-linux-musl)
195
- ffi (1.17.0-arm64-darwin)
196
- ffi (1.17.0-x86-linux-gnu)
197
- ffi (1.17.0-x86-linux-musl)
198
- ffi (1.17.0-x86_64-darwin)
199
- ffi (1.17.0-x86_64-linux-gnu)
200
- ffi (1.17.0-x86_64-linux-musl)
191
+ ffi (1.17.4-aarch64-linux-gnu)
192
+ ffi (1.17.4-aarch64-linux-musl)
193
+ ffi (1.17.4-arm-linux-gnu)
194
+ ffi (1.17.4-arm-linux-musl)
195
+ ffi (1.17.4-arm64-darwin)
196
+ ffi (1.17.4-x86-linux-gnu)
197
+ ffi (1.17.4-x86-linux-musl)
198
+ ffi (1.17.4-x86_64-darwin)
199
+ ffi (1.17.4-x86_64-linux-gnu)
200
+ ffi (1.17.4-x86_64-linux-musl)
201
201
  file_validators (3.0.0)
202
202
  activemodel (>= 3.2)
203
203
  mime-types (>= 1.0)
204
- globalid (1.2.1)
204
+ globalid (1.4.0)
205
205
  activesupport (>= 6.1)
206
- haml (6.3.0)
206
+ haml (6.3.1)
207
207
  temple (>= 0.8.2)
208
208
  thor
209
209
  tilt
@@ -214,15 +214,13 @@ GEM
214
214
  railties (>= 5.1)
215
215
  highline (3.1.2)
216
216
  reline
217
- httparty (0.22.0)
217
+ httparty (0.24.2)
218
218
  csv
219
219
  mini_mime (>= 1.0.0)
220
220
  multi_xml (>= 0.5.2)
221
221
  i18n (1.15.2)
222
222
  concurrent-ruby (~> 1.0)
223
- image_processing (1.13.0)
224
- mini_magick (>= 4.9.5, < 5)
225
- ruby-vips (>= 2.0.17, < 3)
223
+ image_processing (2.0.2)
226
224
  io-console (0.8.2)
227
225
  irb (1.18.0)
228
226
  pp (>= 0.6.0)
@@ -231,7 +229,7 @@ GEM
231
229
  reline (>= 0.4.2)
232
230
  jsbundling-rails (1.3.1)
233
231
  railties (>= 6.0.0)
234
- json (2.8.1)
232
+ json (2.21.2)
235
233
  kraken-io (0.1.3)
236
234
  activesupport
237
235
  httparty
@@ -240,34 +238,36 @@ GEM
240
238
  launchy (3.0.1)
241
239
  addressable (~> 2.8)
242
240
  childprocess (~> 5.0)
243
- libv8-node (18.19.0.0)
244
- libv8-node (18.19.0.0-aarch64-linux)
245
- libv8-node (18.19.0.0-aarch64-linux-musl)
246
- libv8-node (18.19.0.0-arm64-darwin)
247
- libv8-node (18.19.0.0-x86_64-darwin)
248
- libv8-node (18.19.0.0-x86_64-linux)
249
- libv8-node (18.19.0.0-x86_64-linux-musl)
241
+ libv8-node (24.12.0.1)
242
+ libv8-node (24.12.0.1-aarch64-linux)
243
+ libv8-node (24.12.0.1-aarch64-linux-musl)
244
+ libv8-node (24.12.0.1-arm64-darwin)
245
+ libv8-node (24.12.0.1-x86_64-darwin)
246
+ libv8-node (24.12.0.1-x86_64-linux)
247
+ libv8-node (24.12.0.1-x86_64-linux-musl)
250
248
  logger (1.7.0)
251
249
  loofah (2.25.2)
252
250
  crass (~> 1.0.2)
253
251
  nokogiri (>= 1.12.0)
254
- mail (2.8.1)
252
+ mail (2.9.1)
253
+ logger
255
254
  mini_mime (>= 0.1.1)
256
255
  net-imap
257
256
  net-pop
258
257
  net-smtp
259
- marcel (1.0.4)
260
- matrix (0.4.2)
258
+ marcel (1.2.1)
259
+ matrix (0.4.3)
261
260
  method_source (1.1.0)
262
- mime-types (3.6.0)
261
+ mime-types (3.7.0)
262
+ logger
263
+ mime-types-data (~> 3.2025, >= 3.2025.0507)
264
+ mime-types-data (3.2026.0701)
265
+ mini_magick (5.3.2)
263
266
  logger
264
- mime-types-data (~> 3.2015)
265
- mime-types-data (3.2024.1105)
266
- mini_magick (4.13.2)
267
267
  mini_mime (1.1.5)
268
268
  mini_portile2 (2.8.9)
269
- mini_racer (0.16.0)
270
- libv8-node (~> 18.19.0.0)
269
+ mini_racer (0.21.4)
270
+ libv8-node (~> 24.12.0.1)
271
271
  minitest (6.0.6)
272
272
  drb (~> 2.0)
273
273
  prism (~> 1.5)
@@ -275,8 +275,9 @@ GEM
275
275
  bigdecimal (>= 3.1, < 5)
276
276
  multipart-post (2.4.1)
277
277
  mutex_m (0.3.0)
278
- mysql2 (0.5.6)
279
- net-imap (0.5.15)
278
+ mysql2 (0.5.7)
279
+ bigdecimal
280
+ net-imap (0.6.6)
280
281
  date
281
282
  net-protocol
282
283
  net-pop (0.1.2)
@@ -285,7 +286,7 @@ GEM
285
286
  timeout
286
287
  net-smtp (0.5.1)
287
288
  net-protocol
288
- nio4r (2.7.4)
289
+ nio4r (2.7.5)
289
290
  nokogiri (1.19.4)
290
291
  mini_portile2 (~> 2.8.2)
291
292
  racc (~> 1.4)
@@ -342,20 +343,20 @@ GEM
342
343
  rackup (2.3.1)
343
344
  rack (>= 3)
344
345
  radius (0.8.0)
345
- rails (7.2.2.1)
346
- actioncable (= 7.2.2.1)
347
- actionmailbox (= 7.2.2.1)
348
- actionmailer (= 7.2.2.1)
349
- actionpack (= 7.2.2.1)
350
- actiontext (= 7.2.2.1)
351
- actionview (= 7.2.2.1)
352
- activejob (= 7.2.2.1)
353
- activemodel (= 7.2.2.1)
354
- activerecord (= 7.2.2.1)
355
- activestorage (= 7.2.2.1)
356
- activesupport (= 7.2.2.1)
346
+ rails (8.0.5.1)
347
+ actioncable (= 8.0.5.1)
348
+ actionmailbox (= 8.0.5.1)
349
+ actionmailer (= 8.0.5.1)
350
+ actionpack (= 8.0.5.1)
351
+ actiontext (= 8.0.5.1)
352
+ actionview (= 8.0.5.1)
353
+ activejob (= 8.0.5.1)
354
+ activemodel (= 8.0.5.1)
355
+ activerecord (= 8.0.5.1)
356
+ activestorage (= 8.0.5.1)
357
+ activesupport (= 8.0.5.1)
357
358
  bundler (>= 1.15.0)
358
- railties (= 7.2.2.1)
359
+ railties (= 8.0.5.1)
359
360
  rails-dom-testing (2.3.0)
360
361
  activesupport (>= 5.0.0)
361
362
  minitest
@@ -365,20 +366,21 @@ GEM
365
366
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
366
367
  rails-observers (0.1.5)
367
368
  activemodel (>= 4.0)
368
- railties (7.2.2.1)
369
- actionpack (= 7.2.2.1)
370
- activesupport (= 7.2.2.1)
369
+ railties (8.0.5.1)
370
+ actionpack (= 8.0.5.1)
371
+ activesupport (= 8.0.5.1)
371
372
  irb (~> 1.13)
372
373
  rackup (>= 1.0.0)
373
374
  rake (>= 12.2)
374
375
  thor (~> 1.0, >= 1.2.2)
376
+ tsort (>= 0.2)
375
377
  zeitwerk (~> 2.6)
376
378
  rake (13.4.2)
377
379
  ransack (4.2.1)
378
380
  activerecord (>= 6.1.5)
379
381
  activesupport (>= 6.1.5)
380
382
  i18n
381
- rbs (4.0.3)
383
+ rbs (4.1.2)
382
384
  logger
383
385
  prism (>= 1.6.0)
384
386
  tsort
@@ -387,7 +389,7 @@ GEM
387
389
  prism (>= 1.6.0)
388
390
  rbs (>= 4.0.0)
389
391
  tsort
390
- regexp_parser (2.9.2)
392
+ regexp_parser (2.12.0)
391
393
  reline (0.6.3)
392
394
  io-console (~> 0.5)
393
395
  request_store (1.7.0)
@@ -406,12 +408,12 @@ GEM
406
408
  chunky_png (~> 1.0)
407
409
  rqrcode_core (~> 2.0)
408
410
  rqrcode_core (2.1.0)
409
- rspec-core (3.13.4)
411
+ rspec-core (3.13.6)
410
412
  rspec-support (~> 3.13.0)
411
413
  rspec-expectations (3.13.5)
412
414
  diff-lcs (>= 1.2.0, < 2.0)
413
415
  rspec-support (~> 3.13.0)
414
- rspec-mocks (3.13.5)
416
+ rspec-mocks (3.13.8)
415
417
  diff-lcs (>= 1.2.0, < 2.0)
416
418
  rspec-support (~> 3.13.0)
417
419
  rspec-rails (7.1.1)
@@ -422,12 +424,9 @@ GEM
422
424
  rspec-expectations (~> 3.13)
423
425
  rspec-mocks (~> 3.13)
424
426
  rspec-support (~> 3.13)
425
- rspec-support (3.13.4)
427
+ rspec-support (3.13.7)
426
428
  rspec_junit_formatter (0.6.0)
427
429
  rspec-core (>= 2, < 4, != 2.12.0)
428
- ruby-vips (2.2.2)
429
- ffi (~> 1.12)
430
- logger
431
430
  sass-rails (6.0.0)
432
431
  sassc-rails (~> 2.1, >= 2.1.1)
433
432
  sassc (2.4.0)
@@ -439,15 +438,11 @@ GEM
439
438
  sprockets-rails
440
439
  tilt
441
440
  securerandom (0.4.1)
442
- simplecov (0.22.0)
443
- docile (~> 1.1)
444
- simplecov-html (~> 0.11)
445
- simplecov_json_formatter (~> 0.1)
446
- simplecov-html (0.13.1)
447
- simplecov-lcov (0.8.0)
448
- simplecov_json_formatter (0.1.4)
449
- sprockets (4.2.1)
441
+ simplecov (1.0.3)
442
+ simplecov-lcov (0.9.0)
443
+ sprockets (4.2.2)
450
444
  concurrent-ruby (~> 1.0)
445
+ logger
451
446
  rack (>= 2.2.4, < 4)
452
447
  sprockets-rails (3.5.2)
453
448
  actionpack (>= 6.1)
@@ -456,9 +451,9 @@ GEM
456
451
  ssrf_filter (1.5.0)
457
452
  stringex (2.8.6)
458
453
  stringio (3.2.0)
459
- temple (0.10.3)
454
+ temple (0.10.4)
460
455
  thor (1.5.0)
461
- tilt (2.4.0)
456
+ tilt (2.8.0)
462
457
  timeout (0.6.1)
463
458
  trustygems (0.2.1)
464
459
  rake
@@ -467,7 +462,7 @@ GEM
467
462
  concurrent-ruby (~> 1.0)
468
463
  uglifier (4.2.1)
469
464
  execjs (>= 0.3.0, < 3)
470
- uri (1.0.4)
465
+ uri (1.1.1)
471
466
  useragent (0.16.11)
472
467
  warden (1.2.9)
473
468
  rack (>= 2.0.9)
@@ -478,7 +473,7 @@ GEM
478
473
  will_paginate (4.0.1)
479
474
  xpath (3.2.0)
480
475
  nokogiri (~> 1.8)
481
- zeitwerk (2.8.2)
476
+ zeitwerk (2.8.3)
482
477
 
483
478
  PLATFORMS
484
479
  aarch64-linux
@@ -17,7 +17,11 @@ end
17
17
  module TrustyCms
18
18
  class Application < Rails::Application
19
19
  include TrustyCms::Initializer
20
- config.load_defaults 7.2
20
+ config.load_defaults 8.0
21
+
22
+ # Rails 8.1 will make `to_time` always preserve the receiver's timezone.
23
+ # Opt in now to silence the deprecation and get the new behavior.
24
+ config.active_support.to_time_preserves_timezone = :zone
21
25
 
22
26
  Rails.autoloaders.log!
23
27
  # Enable the asset pipeline
@@ -14,8 +14,10 @@ class String
14
14
  end
15
15
 
16
16
  unless methods.include?('parameterize')
17
- def parameterize(sep = '-')
18
- remove_formatting.downcase.replace_whitespace(sep).collapse(sep)
17
+ def parameterize(separator = '-', preserve_case: false, locale: nil)
18
+ separator = '-' unless separator.is_a?(String)
19
+ slug = remove_formatting.replace_whitespace(separator).collapse(separator)
20
+ preserve_case ? slug : slug.downcase
19
21
  end
20
22
  end
21
23
 
@@ -1,3 +1,3 @@
1
1
  module TrustyCms
2
- VERSION = '7.1.3'.freeze
2
+ VERSION = '8.0'.freeze
3
3
  end
@@ -0,0 +1,124 @@
1
+ require 'spec_helper'
2
+ require 'rack/test'
3
+
4
+ # Exercises Admin::AssetsController, which overrides the ResourceController CRUD
5
+ # with custom upload handling (process_uploaded_asset, maybe_compress,
6
+ # failure_response, set_owner_or_editor). Uses the JSON/partial endpoints so the
7
+ # specs don't depend on the asset-pipeline-heavy admin HTML layout. High-value
8
+ # regression net for a Rails/Ruby upgrade — file uploads and content-type
9
+ # negotiation are common breakage points.
10
+ RSpec.describe Admin::AssetsController, type: :controller do
11
+ routes { TrustyCms::Application.routes }
12
+
13
+ let(:user) { create(:admin) }
14
+ let(:fixtures_path) { TrustyCms::Engine.root.join('spec', 'fixtures', 'files') }
15
+
16
+ before do
17
+ # approved_content_types derives from the AssetType registry, which is empty
18
+ # by default; register the canonical set (shared with asset_spec) so uploads
19
+ # of text/plain, images, etc. can be approved. See AssetTypeRegistry.
20
+ register_standard_asset_types
21
+
22
+ # public_url generation needs a host; controller specs don't set one on the
23
+ # Disk service the way a real request would.
24
+ @previous_active_storage_url_options = ActiveStorage::Current.url_options
25
+ ActiveStorage::Current.url_options = { host: 'test.host', protocol: 'http' }
26
+
27
+ allow(controller).to receive(:authenticate_user!).and_return(true)
28
+ allow(controller).to receive(:current_user).and_return(user)
29
+ end
30
+
31
+ after do
32
+ ActiveStorage::Current.url_options = @previous_active_storage_url_options
33
+ end
34
+
35
+ # A plain stub (not an rspec double) so it can be assigned in an `around`
36
+ # hook, which runs outside the per-test double lifecycle. api_key: nil makes
37
+ # should_compress? false, so uploads skip Kraken compression.
38
+ around do |example|
39
+ original_kraken = defined?($kraken) ? $kraken : nil
40
+ $kraken = Struct.new(:api_key).new(nil)
41
+ example.run
42
+ $kraken = original_kraken
43
+ end
44
+
45
+ def upload(filename, content_type)
46
+ Rack::Test::UploadedFile.new(fixtures_path.join(filename), content_type)
47
+ end
48
+
49
+ describe 'POST #uploader' do
50
+ it 'returns the asset url when the upload succeeds' do
51
+ expect {
52
+ post :uploader, params: { upload: upload('sample.txt', 'text/plain') }, format: :json
53
+ }.to change(Asset, :count).by(1)
54
+
55
+ expect(response).to have_http_status(:ok)
56
+ expect(JSON.parse(response.body)).to have_key('url')
57
+ end
58
+
59
+ it 'records the uploading user as owner/editor' do
60
+ post :uploader, params: { upload: upload('sample.txt', 'text/plain') }, format: :json
61
+
62
+ asset = Asset.last
63
+ expect(asset.created_by_id).to eq(user.id)
64
+ expect(asset.updated_by_id).to eq(user.id)
65
+ end
66
+
67
+ it 'returns unsupported media type for disallowed content types' do
68
+ expect(Asset).not_to receive(:create)
69
+
70
+ post :uploader, params: { upload: upload('sample.txt', 'application/x-unsupported') }, format: :json
71
+
72
+ expect(response).to have_http_status(:unsupported_media_type)
73
+ expect(JSON.parse(response.body)['error']).to eq('Unsupported file type.')
74
+ expect(flash[:error]).to eq('Unsupported file type.')
75
+ end
76
+
77
+ it 'rejects the generic octet-stream content type with a notice' do
78
+ post :uploader, params: { upload: upload('sample.txt', 'application/octet-stream') }, format: :json
79
+
80
+ expect(response).to have_http_status(:unprocessable_entity)
81
+ expect(JSON.parse(response.body)['error']).to match(/valid extension/)
82
+ expect(flash[:notice]).to match(/valid extension/)
83
+ end
84
+
85
+ it 'returns unprocessable entity when no file is provided' do
86
+ post :uploader, params: {}, format: :json
87
+
88
+ expect(response).to have_http_status(:unprocessable_entity)
89
+ expect(JSON.parse(response.body)['error']).to eq('No file uploaded.')
90
+ expect(flash[:error]).to eq('No file uploaded.')
91
+ end
92
+ end
93
+
94
+ describe 'POST #create' do
95
+ it 'creates an asset from an uploaded file and redirects (HTML)' do
96
+ expect {
97
+ post :create, params: { asset: { asset: [upload('sample.txt', 'text/plain')] } }
98
+ }.to change(Asset, :count).by(1)
99
+
100
+ expect(response).to be_redirect
101
+ end
102
+
103
+ it 'redirects back to new with a flash error when the upload is unsupported' do
104
+ expect {
105
+ post :create, params: { asset: { asset: [upload('sample.txt', 'application/x-unsupported')] } }
106
+ }.not_to change(Asset, :count)
107
+
108
+ expect(response).to redirect_to(new_admin_asset_path)
109
+ expect(flash[:error]).to eq('Unsupported file type.')
110
+ end
111
+ end
112
+
113
+ describe 'DELETE #destroy' do
114
+ it 'destroys the asset and redirects' do
115
+ asset = Asset.create!(asset: upload('sample.txt', 'text/plain'), caption: '')
116
+
117
+ expect {
118
+ delete :destroy, params: { id: asset.id }
119
+ }.to change(Asset, :count).by(-1)
120
+
121
+ expect(response).to be_redirect
122
+ end
123
+ end
124
+ end