hanami 2.1.0.beta1 → 2.1.0.beta2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -4
  3. data/README.md +1 -1
  4. data/lib/hanami/app.rb +5 -0
  5. data/lib/hanami/config/actions.rb +4 -7
  6. data/lib/hanami/config/assets.rb +84 -0
  7. data/lib/hanami/config/null_config.rb +3 -0
  8. data/lib/hanami/config.rb +17 -5
  9. data/lib/hanami/extensions/action.rb +4 -2
  10. data/lib/hanami/extensions/view/standard_helpers.rb +4 -0
  11. data/lib/hanami/helpers/assets_helper.rb +772 -0
  12. data/lib/hanami/middleware/assets.rb +21 -0
  13. data/lib/hanami/middleware/render_errors.rb +4 -7
  14. data/lib/hanami/providers/assets.rb +44 -0
  15. data/lib/hanami/rake_tasks.rb +19 -18
  16. data/lib/hanami/settings.rb +1 -1
  17. data/lib/hanami/slice.rb +25 -4
  18. data/lib/hanami/version.rb +1 -1
  19. data/lib/hanami.rb +2 -2
  20. data/spec/integration/assets/assets_spec.rb +101 -0
  21. data/spec/integration/assets/serve_static_assets_spec.rb +152 -0
  22. data/spec/integration/logging/exception_logging_spec.rb +115 -0
  23. data/spec/integration/logging/notifications_spec.rb +68 -0
  24. data/spec/integration/logging/request_logging_spec.rb +128 -0
  25. data/spec/integration/rack_app/middleware_spec.rb +4 -4
  26. data/spec/integration/rack_app/rack_app_spec.rb +0 -221
  27. data/spec/integration/rake_tasks_spec.rb +107 -0
  28. data/spec/integration/view/context/assets_spec.rb +3 -9
  29. data/spec/integration/web/render_detailed_errors_spec.rb +17 -0
  30. data/spec/integration/web/render_errors_spec.rb +6 -4
  31. data/spec/support/app_integration.rb +46 -2
  32. data/spec/unit/hanami/config/actions/content_security_policy_spec.rb +24 -36
  33. data/spec/unit/hanami/config/actions/csrf_protection_spec.rb +4 -3
  34. data/spec/unit/hanami/config/actions/default_values_spec.rb +3 -2
  35. data/spec/unit/hanami/env_spec.rb +11 -25
  36. data/spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb +109 -0
  37. data/spec/unit/hanami/helpers/assets_helper/audio_spec.rb +136 -0
  38. data/spec/unit/hanami/helpers/assets_helper/favicon_spec.rb +91 -0
  39. data/spec/unit/hanami/helpers/assets_helper/image_spec.rb +96 -0
  40. data/spec/unit/hanami/helpers/assets_helper/javascript_spec.rb +147 -0
  41. data/spec/unit/hanami/helpers/assets_helper/stylesheet_spec.rb +130 -0
  42. data/spec/unit/hanami/helpers/assets_helper/video_spec.rb +136 -0
  43. data/spec/unit/hanami/version_spec.rb +1 -1
  44. metadata +32 -4
  45. data/lib/hanami/assets/app_config.rb +0 -61
  46. data/lib/hanami/assets/config.rb +0 -53
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#javascript", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def javascript(...)
18
+ subject.javascript(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ write "app/assets/js/app.ts", <<~JS
48
+ import "../css/app.css";
49
+
50
+ console.log("Hello from index.ts");
51
+ JS
52
+
53
+ write "app/assets/css/app.css", <<~CSS
54
+ .btn {
55
+ background: #f00;
56
+ }
57
+ CSS
58
+
59
+ stub_assets("feature-a.js")
60
+
61
+ require "hanami/setup"
62
+ before_prepare if respond_to?(:before_prepare)
63
+ require "hanami/prepare"
64
+ end
65
+ end
66
+
67
+ it "returns an instance of SafeString" do
68
+ actual = javascript("feature-a")
69
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
70
+ end
71
+
72
+ it "is aliased as #js" do
73
+ expect(subject.js("feature-a")).to eq javascript("feature-a")
74
+ end
75
+
76
+ it "is aliased as #javascript_tag" do
77
+ expect(subject.javascript_tag("feature-a")).to eq javascript("feature-a")
78
+ end
79
+
80
+ it "renders <script> tag" do
81
+ actual = javascript("feature-a")
82
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
83
+ end
84
+
85
+ xit "renders <script> tag without appending ext after query string" do
86
+ actual = javascript("feature-x?callback=init")
87
+ expect(actual).to eq(%(<script src="/assets/feature-x?callback=init" type="text/javascript"></script>))
88
+ end
89
+
90
+ it "renders <script> tag with a defer attribute" do
91
+ actual = javascript("feature-a", defer: true)
92
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" defer="defer"></script>))
93
+ end
94
+
95
+ it "renders <script> tag with an integrity attribute" do
96
+ actual = javascript("feature-a", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")
97
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="anonymous"></script>))
98
+ end
99
+
100
+ it "renders <script> tag with a crossorigin attribute" do
101
+ actual = javascript("feature-a", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC", crossorigin: "use-credentials")
102
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="use-credentials"></script>))
103
+ end
104
+
105
+ it "ignores src passed as an option" do
106
+ actual = javascript("feature-a", src: "wrong")
107
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
108
+ end
109
+
110
+ describe "async option" do
111
+ it "renders <script> tag with an async=true if async option is true" do
112
+ actual = javascript("feature-a", async: true)
113
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" async="async"></script>))
114
+ end
115
+
116
+ it "renders <script> tag without an async=true if async option is false" do
117
+ actual = javascript("feature-a", async: false)
118
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
119
+ end
120
+ end
121
+
122
+ describe "subresource_integrity mode" do
123
+ def before_prepare
124
+ Hanami.app.config.assets.subresource_integrity = [:sha384]
125
+ end
126
+
127
+ before { compile_assets! }
128
+
129
+ it "includes subresource_integrity and crossorigin attributes" do
130
+ actual = javascript("app")
131
+ expect(actual).to match(%r{<script src="/assets/app-[A-Z0-9]{8}.js" type="text/javascript" integrity="sha384-[A-Za-z0-9+/]{64}" crossorigin="anonymous"></script>})
132
+ end
133
+ end
134
+
135
+ describe "cdn mode" do
136
+ let(:base_url) { "https://hanami.test" }
137
+
138
+ def before_prepare
139
+ Hanami.app.config.assets.base_url = "https://hanami.test"
140
+ end
141
+
142
+ it "returns absolute url for src attribute" do
143
+ actual = javascript("feature-a")
144
+ expect(actual).to eq(%(<script src="#{base_url}/assets/feature-a.js" type="text/javascript"></script>))
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#stylesheet", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def stylesheet(...)
18
+ subject.stylesheet(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ write "app/assets/js/app.ts", <<~JS
48
+ import "../css/app.css";
49
+
50
+ console.log("Hello from index.ts");
51
+ JS
52
+
53
+ write "app/assets/css/app.css", <<~CSS
54
+ .btn {
55
+ background: #f00;
56
+ }
57
+ CSS
58
+
59
+ stub_assets("main.css")
60
+
61
+ require "hanami/setup"
62
+ before_prepare if respond_to?(:before_prepare)
63
+ require "hanami/prepare"
64
+ end
65
+ end
66
+
67
+ it "returns an instance of SafeString" do
68
+ actual = stylesheet("main")
69
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
70
+ end
71
+
72
+ it "is aliased as #css" do
73
+ expect(subject.css("main")).to eq stylesheet("main")
74
+ end
75
+
76
+ it "is aliased as #stylesheet_link_tag" do
77
+ expect(subject.stylesheet_link_tag("main")).to eq stylesheet("main")
78
+ end
79
+
80
+ it "renders <link> tag" do
81
+ actual = stylesheet("main")
82
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet">))
83
+ end
84
+
85
+ xit "renders <link> tag without appending ext after query string" do
86
+ actual = stylesheet("fonts?font=Helvetica")
87
+ expect(actual).to eq(%(<link href="/assets/fonts?font=Helvetica" type="text/css" rel="stylesheet">))
88
+ end
89
+
90
+ it "renders <link> tag with an integrity attribute" do
91
+ actual = stylesheet("main", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")
92
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="anonymous">))
93
+ end
94
+
95
+ it "renders <link> tag with a crossorigin attribute" do
96
+ actual = stylesheet("main", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC", crossorigin: "use-credentials")
97
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="use-credentials">))
98
+ end
99
+
100
+ it "ignores href passed as an option" do
101
+ actual = stylesheet("main", href: "wrong")
102
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet">))
103
+ end
104
+
105
+ describe "subresource_integrity mode" do
106
+ def before_prepare
107
+ Hanami.app.config.assets.subresource_integrity = [:sha384]
108
+ end
109
+
110
+ before { compile_assets! }
111
+
112
+ it "includes subresource_integrity and crossorigin attributes" do
113
+ actual = stylesheet("app")
114
+ expect(actual).to match(%r{<link href="/assets/app-[A-Z0-9]{8}.css" type="text/css" rel="stylesheet" integrity="sha384-[A-Za-z0-9+/]{64}" crossorigin="anonymous">})
115
+ end
116
+ end
117
+
118
+ describe "cdn mode" do
119
+ let(:base_url) { "https://hanami.test" }
120
+
121
+ def before_prepare
122
+ Hanami.app.config.assets.base_url = base_url
123
+ end
124
+
125
+ it "returns absolute url for href attribute" do
126
+ actual = stylesheet("main")
127
+ expect(actual).to eq(%(<link href="#{base_url}/assets/main.css" type="text/css" rel="stylesheet">))
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#video", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def video(...)
18
+ subject.video(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ stub_assets("movie.mp4", "movie.en.vtt")
48
+
49
+ require "hanami/setup"
50
+ before_prepare if respond_to?(:before_prepare)
51
+ require "hanami/prepare"
52
+ end
53
+ end
54
+
55
+ it "returns an instance of HtmlBuilder" do
56
+ actual = video("movie.mp4")
57
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
58
+ end
59
+
60
+ it "renders <video> tag" do
61
+ actual = video("movie.mp4").to_s
62
+ expect(actual).to eq(%(<video src="/assets/movie.mp4"></video>))
63
+ end
64
+
65
+ it "is aliased as #video_tag" do
66
+ expect(video("movie.mp4")).to eq(subject.video_tag("movie.mp4"))
67
+ end
68
+
69
+ it "renders with html attributes" do
70
+ actual = video("movie.mp4", autoplay: true, controls: true).to_s
71
+ expect(actual).to eq(%(<video autoplay="autoplay" controls="controls" src="/assets/movie.mp4"></video>))
72
+ end
73
+
74
+ it "renders with fallback content" do
75
+ actual = video("movie.mp4") do
76
+ "Your browser does not support the video tag"
77
+ end.to_s
78
+
79
+ expect(actual).to eq(%(<video src="/assets/movie.mp4">Your browser does not support the video tag</video>))
80
+ end
81
+
82
+ it "renders with tracks" do
83
+ actual = video("movie.mp4") do
84
+ tag.track kind: "captions", src: subject.asset_url("movie.en.vtt"), srclang: "en", label: "English"
85
+ end.to_s
86
+
87
+ expect(actual).to eq(%(<video src="/assets/movie.mp4"><track kind="captions" src="/assets/movie.en.vtt" srclang="en" label="English"></video>))
88
+ end
89
+
90
+ xit "renders with sources" do
91
+ actual = subject.video do
92
+ tag.text "Your browser does not support the video tag"
93
+ tag.source src: subject.asset_url("movie.mp4"), type: "video/mp4"
94
+ tag.source src: subject.asset_url("movie.ogg"), type: "video/ogg"
95
+ end.to_s
96
+
97
+ expect(actual).to eq(%(<video>Your browser does not support the video tag<source src="/assets/movie.mp4" type="video/mp4"><source src="/assets/movie.ogg" type="video/ogg"></video>))
98
+ end
99
+
100
+ it "raises an exception when no arguments" do
101
+ expect do
102
+ video
103
+ end.to raise_error(
104
+ ArgumentError,
105
+ "You should provide a source via `src` option or with a `source` HTML tag"
106
+ )
107
+ end
108
+
109
+ it "raises an exception when no src and no block" do
110
+ expect do
111
+ video(content: true)
112
+ end.to raise_error(
113
+ ArgumentError,
114
+ "You should provide a source via `src` option or with a `source` HTML tag"
115
+ )
116
+ end
117
+
118
+ describe "cdn mode" do
119
+ let(:base_url) { "https://hanami.test" }
120
+
121
+ def before_prepare
122
+ Hanami.app.config.assets.base_url = "https://hanami.test"
123
+ end
124
+
125
+ it "returns absolute url for src attribute" do
126
+ actual = video("movie.mp4").to_s
127
+ expect(actual).to eq(%(<video src="#{base_url}/assets/movie.mp4"></video>))
128
+ end
129
+ end
130
+
131
+ private
132
+
133
+ def tag(...)
134
+ subject.__send__(:tag, ...)
135
+ end
136
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  RSpec.describe "Hanami::VERSION" do
4
4
  it "returns current version" do
5
- expect(Hanami::VERSION).to eq("2.1.0.beta1")
5
+ expect(Hanami::VERSION).to eq("2.1.0.beta2.1")
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta1
4
+ version: 2.1.0.beta2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -255,14 +255,13 @@ files:
255
255
  - hanami.gemspec
256
256
  - lib/hanami.rb
257
257
  - lib/hanami/app.rb
258
- - lib/hanami/assets/app_config.rb
259
- - lib/hanami/assets/config.rb
260
258
  - lib/hanami/boot.rb
261
259
  - lib/hanami/config.rb
262
260
  - lib/hanami/config/actions.rb
263
261
  - lib/hanami/config/actions/content_security_policy.rb
264
262
  - lib/hanami/config/actions/cookies.rb
265
263
  - lib/hanami/config/actions/sessions.rb
264
+ - lib/hanami/config/assets.rb
266
265
  - lib/hanami/config/logger.rb
267
266
  - lib/hanami/config/null_config.rb
268
267
  - lib/hanami/config/router.rb
@@ -282,13 +281,16 @@ files:
282
281
  - lib/hanami/extensions/view/slice_configured_helpers.rb
283
282
  - lib/hanami/extensions/view/slice_configured_view.rb
284
283
  - lib/hanami/extensions/view/standard_helpers.rb
284
+ - lib/hanami/helpers/assets_helper.rb
285
285
  - lib/hanami/helpers/form_helper.rb
286
286
  - lib/hanami/helpers/form_helper/form_builder.rb
287
287
  - lib/hanami/helpers/form_helper/values.rb
288
+ - lib/hanami/middleware/assets.rb
288
289
  - lib/hanami/middleware/public_errors_app.rb
289
290
  - lib/hanami/middleware/render_errors.rb
290
291
  - lib/hanami/port.rb
291
292
  - lib/hanami/prepare.rb
293
+ - lib/hanami/providers/assets.rb
292
294
  - lib/hanami/providers/inflector.rb
293
295
  - lib/hanami/providers/logger.rb
294
296
  - lib/hanami/providers/rack.rb
@@ -319,6 +321,8 @@ files:
319
321
  - spec/integration/action/view_rendering/paired_view_inference_spec.rb
320
322
  - spec/integration/action/view_rendering/view_context_spec.rb
321
323
  - spec/integration/action/view_rendering_spec.rb
324
+ - spec/integration/assets/assets_spec.rb
325
+ - spec/integration/assets/serve_static_assets_spec.rb
322
326
  - spec/integration/code_loading/loading_from_app_spec.rb
323
327
  - spec/integration/code_loading/loading_from_lib_spec.rb
324
328
  - spec/integration/code_loading/loading_from_slice_spec.rb
@@ -333,10 +337,14 @@ files:
333
337
  - spec/integration/container/standard_providers/rack_provider_spec.rb
334
338
  - spec/integration/container/standard_providers_spec.rb
335
339
  - spec/integration/dotenv_loading_spec.rb
340
+ - spec/integration/logging/exception_logging_spec.rb
341
+ - spec/integration/logging/notifications_spec.rb
342
+ - spec/integration/logging/request_logging_spec.rb
336
343
  - spec/integration/rack_app/body_parser_spec.rb
337
344
  - spec/integration/rack_app/middleware_spec.rb
338
345
  - spec/integration/rack_app/non_booted_rack_app_spec.rb
339
346
  - spec/integration/rack_app/rack_app_spec.rb
347
+ - spec/integration/rake_tasks_spec.rb
340
348
  - spec/integration/settings/access_in_slice_class_body_spec.rb
341
349
  - spec/integration/settings/access_to_constants_spec.rb
342
350
  - spec/integration/settings/loading_from_env_spec.rb
@@ -397,6 +405,13 @@ files:
397
405
  - spec/unit/hanami/config/views_spec.rb
398
406
  - spec/unit/hanami/env_spec.rb
399
407
  - spec/unit/hanami/extensions/view/context_spec.rb
408
+ - spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb
409
+ - spec/unit/hanami/helpers/assets_helper/audio_spec.rb
410
+ - spec/unit/hanami/helpers/assets_helper/favicon_spec.rb
411
+ - spec/unit/hanami/helpers/assets_helper/image_spec.rb
412
+ - spec/unit/hanami/helpers/assets_helper/javascript_spec.rb
413
+ - spec/unit/hanami/helpers/assets_helper/stylesheet_spec.rb
414
+ - spec/unit/hanami/helpers/assets_helper/video_spec.rb
400
415
  - spec/unit/hanami/helpers/form_helper_spec.rb
401
416
  - spec/unit/hanami/port_spec.rb
402
417
  - spec/unit/hanami/router/errors/not_allowed_error_spec.rb
@@ -444,6 +459,8 @@ test_files:
444
459
  - spec/integration/action/view_rendering/paired_view_inference_spec.rb
445
460
  - spec/integration/action/view_rendering/view_context_spec.rb
446
461
  - spec/integration/action/view_rendering_spec.rb
462
+ - spec/integration/assets/assets_spec.rb
463
+ - spec/integration/assets/serve_static_assets_spec.rb
447
464
  - spec/integration/code_loading/loading_from_app_spec.rb
448
465
  - spec/integration/code_loading/loading_from_lib_spec.rb
449
466
  - spec/integration/code_loading/loading_from_slice_spec.rb
@@ -458,10 +475,14 @@ test_files:
458
475
  - spec/integration/container/standard_providers/rack_provider_spec.rb
459
476
  - spec/integration/container/standard_providers_spec.rb
460
477
  - spec/integration/dotenv_loading_spec.rb
478
+ - spec/integration/logging/exception_logging_spec.rb
479
+ - spec/integration/logging/notifications_spec.rb
480
+ - spec/integration/logging/request_logging_spec.rb
461
481
  - spec/integration/rack_app/body_parser_spec.rb
462
482
  - spec/integration/rack_app/middleware_spec.rb
463
483
  - spec/integration/rack_app/non_booted_rack_app_spec.rb
464
484
  - spec/integration/rack_app/rack_app_spec.rb
485
+ - spec/integration/rake_tasks_spec.rb
465
486
  - spec/integration/settings/access_in_slice_class_body_spec.rb
466
487
  - spec/integration/settings/access_to_constants_spec.rb
467
488
  - spec/integration/settings/loading_from_env_spec.rb
@@ -522,6 +543,13 @@ test_files:
522
543
  - spec/unit/hanami/config/views_spec.rb
523
544
  - spec/unit/hanami/env_spec.rb
524
545
  - spec/unit/hanami/extensions/view/context_spec.rb
546
+ - spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb
547
+ - spec/unit/hanami/helpers/assets_helper/audio_spec.rb
548
+ - spec/unit/hanami/helpers/assets_helper/favicon_spec.rb
549
+ - spec/unit/hanami/helpers/assets_helper/image_spec.rb
550
+ - spec/unit/hanami/helpers/assets_helper/javascript_spec.rb
551
+ - spec/unit/hanami/helpers/assets_helper/stylesheet_spec.rb
552
+ - spec/unit/hanami/helpers/assets_helper/video_spec.rb
525
553
  - spec/unit/hanami/helpers/form_helper_spec.rb
526
554
  - spec/unit/hanami/port_spec.rb
527
555
  - spec/unit/hanami/router/errors/not_allowed_error_spec.rb
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/configurable"
4
-
5
- module Hanami
6
- # @api private
7
- module Assets
8
- # App config for assets.
9
- #
10
- # This is NOT RELEASED as of 2.0.0.
11
- #
12
- # @api private
13
- class AppConfig
14
- include Dry::Configurable
15
-
16
- attr_reader :base_config
17
- protected :base_config
18
-
19
- setting :server_url, default: "http://localhost:8080"
20
-
21
- def initialize(*)
22
- super
23
-
24
- @base_config = Assets::Config.new
25
- end
26
-
27
- def initialize_copy(source)
28
- super
29
- @base_config = source.base_config.dup
30
- end
31
-
32
- def finalize!
33
- end
34
-
35
- # Returns the list of available settings
36
- #
37
- # @return [Set]
38
- #
39
- # @api private
40
- def settings
41
- base_config.settings + self.class.settings
42
- end
43
-
44
- private
45
-
46
- def method_missing(name, *args, &block)
47
- if config.respond_to?(name)
48
- config.public_send(name, *args, &block)
49
- elsif base_config.respond_to?(name)
50
- base_config.public_send(name, *args, &block)
51
- else
52
- super
53
- end
54
- end
55
-
56
- def respond_to_missing?(name, _incude_all = false)
57
- config.respond_to?(name) || base_config.respond_to?(name) || super
58
- end
59
- end
60
- end
61
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/configurable"
4
-
5
- module Hanami
6
- module Assets
7
- # App config for assets.
8
- #
9
- # This is NOT RELEASED as of 2.0.0.
10
- #
11
- # @api private
12
- class Config
13
- include Dry::Configurable
14
-
15
- # Initialize the Config
16
- #
17
- # @yield [config] the config object
18
- #
19
- # @return [Config]
20
- #
21
- # @since 2.0.0
22
- # @api private
23
- def initialize(*)
24
- super
25
- yield self if block_given?
26
- end
27
-
28
- # Returns the list of available settings
29
- #
30
- # @return [Set]
31
- #
32
- # @since 2.0.0
33
- # @api private
34
- def settings
35
- self.class.settings
36
- end
37
-
38
- private
39
-
40
- def method_missing(name, *args, &block)
41
- if config.respond_to?(name)
42
- config.public_send(name, *args, &block)
43
- else
44
- super
45
- end
46
- end
47
-
48
- def respond_to_missing?(name, _incude_all = false)
49
- config.respond_to?(name) || super
50
- end
51
- end
52
- end
53
- end