hanami 2.3.0.beta1 → 2.3.0.beta2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/hanami.gemspec +7 -7
- data/lib/hanami/config.rb +4 -4
- data/lib/hanami/extensions/view/context.rb +0 -10
- data/lib/hanami/extensions/view/slice_configured_context.rb +0 -7
- data/lib/hanami/routes.rb +3 -3
- data/lib/hanami/slice.rb +12 -0
- data/lib/hanami/version.rb +1 -1
- data/spec/integration/action/format_config_spec.rb +6 -3
- data/spec/integration/action/slice_configuration_spec.rb +36 -36
- data/spec/integration/rack_app/body_parser_spec.rb +2 -1
- data/spec/integration/rack_app/rack_app_spec.rb +2 -2
- data/spec/unit/hanami/config/actions_spec.rb +2 -2
- metadata +10 -14
- data/spec/integration/view/context/settings_spec.rb +0 -46
- data/spec/unit/hanami/version_spec.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2b1e7bd746a82ee41c5240dff465f74f79c783ebd9ed73c21b41144dff2a641
|
|
4
|
+
data.tar.gz: d0b26e86ba4736cdd2841abf353ad58d3064f381a6e45adb615c4d8c28ca7c95
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35f0d90cf493960b018734f68aa210b362195d1efbca45308efa8c877f9ec6220b37a1cd8a753034d3a4e27a623de7d40bd8d02b0786b140b5dd0fda631de246
|
|
7
|
+
data.tar.gz: 735d731e95a0edc4858e8d1930e10540664f25ed3f9069bda184570e9056800f83cc6f2b3ac0703e45e261d33e163e9cb55c80c76b1dc95be074901b691a261a
|
data/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
### Security
|
|
16
16
|
|
|
17
|
+
## [v2.3.0.beta1] - 2025-10-17
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Use updated API for `config.actions.formats`. (@timriley in #1544)
|
|
22
|
+
- Show relative paths in `MissingActionError`. (@kyleplump and @timriley in #1445)
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
- View context `settings` has been removed and is no longer accessible from templates. (@baweaver in #1536)
|
|
27
|
+
|
|
17
28
|
## [v2.3.0.beta1] - 2025-10-03
|
|
18
29
|
|
|
19
30
|
### Added
|
|
@@ -1512,5 +1523,6 @@ end
|
|
|
1512
1523
|
- [Luca Guidi] Official support for MRI 2.0
|
|
1513
1524
|
|
|
1514
1525
|
|
|
1515
|
-
[unreleased]: https://github.com/hanami/hanami/compare/v2.3.0.
|
|
1526
|
+
[unreleased]: https://github.com/hanami/hanami/compare/v2.3.0.beta2...HEAD
|
|
1527
|
+
[v2.3.0.beta2] https://github.com/hanami/hanami/compare/v2.3.0.beta1...v2.3.0.beta2
|
|
1516
1528
|
[v2.3.0.beta1] https://github.com/hanami/hanami/compare/v2.2.1...v2.3.0.beta1
|
data/hanami.gemspec
CHANGED
|
@@ -7,10 +7,10 @@ require "hanami/version"
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "hanami"
|
|
9
9
|
spec.version = Hanami::VERSION
|
|
10
|
-
spec.authors = ["
|
|
11
|
-
spec.email = ["
|
|
12
|
-
spec.summary = "
|
|
13
|
-
spec.description =
|
|
10
|
+
spec.authors = ["Hanakai team"]
|
|
11
|
+
spec.email = ["info@hanakai.org"]
|
|
12
|
+
spec.summary = "A flexible framework for maintainable Ruby apps"
|
|
13
|
+
spec.description = spec.summary
|
|
14
14
|
spec.homepage = "http://hanamirb.org"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.test_files = Dir["spec/**/*"]
|
|
28
28
|
spec.require_paths = ["lib"]
|
|
29
29
|
spec.metadata["rubygems_mfa_required"] = "true"
|
|
30
|
-
spec.required_ruby_version = ">= 3.
|
|
30
|
+
spec.required_ruby_version = ">= 3.2"
|
|
31
31
|
|
|
32
32
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
33
33
|
|
|
@@ -38,8 +38,8 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.add_dependency "dry-monitor", "~> 1.0", ">= 1.0.1", "< 2"
|
|
39
39
|
spec.add_dependency "dry-system", "~> 1.1"
|
|
40
40
|
spec.add_dependency "dry-logger", "~> 1.0", "< 2"
|
|
41
|
-
spec.add_dependency "hanami-cli", "~> 2.3.0.
|
|
42
|
-
spec.add_dependency "hanami-utils", "~> 2.
|
|
41
|
+
spec.add_dependency "hanami-cli", "~> 2.3.0.beta2"
|
|
42
|
+
spec.add_dependency "hanami-utils", "~> 2.3.0.beta2"
|
|
43
43
|
spec.add_dependency "json", ">= 2.7.2"
|
|
44
44
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
|
45
45
|
spec.add_dependency "rack-session"
|
data/lib/hanami/config.rb
CHANGED
|
@@ -187,12 +187,12 @@ module Hanami
|
|
|
187
187
|
|
|
188
188
|
# @!attribute [rw] console
|
|
189
189
|
# Returns the app's console config
|
|
190
|
-
#
|
|
190
|
+
#
|
|
191
191
|
# @example
|
|
192
192
|
# config.console.engine # => :irb
|
|
193
|
-
#
|
|
193
|
+
#
|
|
194
194
|
# @return [Hanami::Config::Console]
|
|
195
|
-
#
|
|
195
|
+
#
|
|
196
196
|
# @api public
|
|
197
197
|
# @since 2.3.0
|
|
198
198
|
setting :console, default: Hanami::Config::Console.new
|
|
@@ -493,7 +493,7 @@ module Hanami
|
|
|
493
493
|
return if actions.formats.empty?
|
|
494
494
|
return if middleware.stack["/"].map(&:first).any? { |klass| klass == "Hanami::Middleware::BodyParser" }
|
|
495
495
|
|
|
496
|
-
parsers = SUPPORTED_MIDDLEWARE_PARSERS & actions.formats.
|
|
496
|
+
parsers = SUPPORTED_MIDDLEWARE_PARSERS & actions.formats.accepted
|
|
497
497
|
return if parsers.empty?
|
|
498
498
|
|
|
499
499
|
middleware.use(
|
|
@@ -90,28 +90,18 @@ module Hanami
|
|
|
90
90
|
# @since 2.1.0
|
|
91
91
|
attr_reader :inflector
|
|
92
92
|
|
|
93
|
-
# Returns the app's settings.
|
|
94
|
-
#
|
|
95
|
-
# @return [Hanami::Settings] the settings
|
|
96
|
-
#
|
|
97
|
-
# @api public
|
|
98
|
-
# @since 2.1.0
|
|
99
|
-
attr_reader :settings
|
|
100
|
-
|
|
101
93
|
# @see SliceConfiguredContext#define_new
|
|
102
94
|
#
|
|
103
95
|
# @api private
|
|
104
96
|
# @since 2.1.0
|
|
105
97
|
def initialize( # rubocop:disable Metrics/ParameterLists
|
|
106
98
|
inflector: nil,
|
|
107
|
-
settings: nil,
|
|
108
99
|
routes: nil,
|
|
109
100
|
assets: nil,
|
|
110
101
|
request: nil,
|
|
111
102
|
**args
|
|
112
103
|
)
|
|
113
104
|
@inflector = inflector
|
|
114
|
-
@settings = settings
|
|
115
105
|
@routes = routes
|
|
116
106
|
@assets = assets
|
|
117
107
|
@request = request
|
|
@@ -37,18 +37,15 @@ module Hanami
|
|
|
37
37
|
#
|
|
38
38
|
# This includes the following app components:
|
|
39
39
|
# - the configured inflector as `inflector`
|
|
40
|
-
# - "settings" from the app container as `settings`
|
|
41
40
|
# - "routes" from the app container as `routes`
|
|
42
41
|
# - "assets" from the app container as `assets`
|
|
43
42
|
def define_new
|
|
44
43
|
inflector = slice.inflector
|
|
45
|
-
resolve_settings = method(:resolve_settings)
|
|
46
44
|
resolve_routes = method(:resolve_routes)
|
|
47
45
|
resolve_assets = method(:resolve_assets)
|
|
48
46
|
|
|
49
47
|
define_method :new do |**kwargs|
|
|
50
48
|
kwargs[:inflector] ||= inflector
|
|
51
|
-
kwargs[:settings] ||= resolve_settings.()
|
|
52
49
|
kwargs[:routes] ||= resolve_routes.()
|
|
53
50
|
kwargs[:assets] ||= resolve_assets.()
|
|
54
51
|
|
|
@@ -56,10 +53,6 @@ module Hanami
|
|
|
56
53
|
end
|
|
57
54
|
end
|
|
58
55
|
|
|
59
|
-
def resolve_settings
|
|
60
|
-
slice["settings"] if slice.key?("settings")
|
|
61
|
-
end
|
|
62
|
-
|
|
63
56
|
def resolve_routes
|
|
64
57
|
slice["routes"] if slice.key?("routes")
|
|
65
58
|
end
|
data/lib/hanami/routes.rb
CHANGED
|
@@ -36,14 +36,14 @@ module Hanami
|
|
|
36
36
|
def initialize(action_key, slice)
|
|
37
37
|
action_path = action_key.gsub(CONTAINER_KEY_DELIMITER, PATH_DELIMITER)
|
|
38
38
|
action_constant = slice.inflector.camelize(
|
|
39
|
-
|
|
39
|
+
slice.inflector.underscore(slice.namespace.to_s) + PATH_DELIMITER + action_path
|
|
40
40
|
)
|
|
41
|
-
|
|
41
|
+
action_file_path = slice.relative_source_path.join(action_path).to_s.concat(RB_EXT)
|
|
42
42
|
|
|
43
43
|
super(<<~MSG)
|
|
44
44
|
Could not find action with key #{action_key.inspect} in #{slice}
|
|
45
45
|
|
|
46
|
-
To fix this, define the action class #{action_constant} in #{
|
|
46
|
+
To fix this, define the action class #{action_constant} in #{action_file_path}
|
|
47
47
|
MSG
|
|
48
48
|
end
|
|
49
49
|
end
|
data/lib/hanami/slice.rb
CHANGED
|
@@ -223,6 +223,18 @@ module Hanami
|
|
|
223
223
|
app? ? root.join(APP_DIR) : root
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
+
# Returns the slice's root component directory, as a path relative to the app's root.
|
|
227
|
+
#
|
|
228
|
+
# @return [Pathname]
|
|
229
|
+
#
|
|
230
|
+
# @see #source_path
|
|
231
|
+
#
|
|
232
|
+
# @api public
|
|
233
|
+
# @since 2.3.0
|
|
234
|
+
def relative_source_path
|
|
235
|
+
source_path.relative_path_from(app.root)
|
|
236
|
+
end
|
|
237
|
+
|
|
226
238
|
# Returns the slice's configured inflector.
|
|
227
239
|
#
|
|
228
240
|
# Unless explicitly re-configured for the slice, this will be the app's inflector.
|
data/lib/hanami/version.rb
CHANGED
|
@@ -20,7 +20,7 @@ RSpec.describe "App action / Format config", :app_integration do
|
|
|
20
20
|
class App < Hanami::App
|
|
21
21
|
config.logger.stream = StringIO.new
|
|
22
22
|
|
|
23
|
-
config.actions.
|
|
23
|
+
config.actions.formats.accept :json
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
RUBY
|
|
@@ -76,7 +76,10 @@ RSpec.describe "App action / Format config", :app_integration do
|
|
|
76
76
|
class App < Hanami::App
|
|
77
77
|
config.logger.stream = StringIO.new
|
|
78
78
|
|
|
79
|
-
config.actions.formats.
|
|
79
|
+
config.actions.formats.register :json, "application/json",
|
|
80
|
+
accept_types: ["application/json", "application/json+scim"],
|
|
81
|
+
content_types: ["application/json", "application/json+scim"]
|
|
82
|
+
config.actions.formats.accept :json
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
RUBY
|
|
@@ -141,7 +144,7 @@ RSpec.describe "App action / Format config", :app_integration do
|
|
|
141
144
|
class App < Hanami::App
|
|
142
145
|
config.logger.stream = StringIO.new
|
|
143
146
|
|
|
144
|
-
config.actions.
|
|
147
|
+
config.actions.formats.accept :json
|
|
145
148
|
config.middleware.use :body_parser, [json: "application/json+custom"]
|
|
146
149
|
end
|
|
147
150
|
end
|
|
@@ -34,25 +34,25 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
34
34
|
it "applies default actions config from the app", :aggregate_failures do
|
|
35
35
|
prepare_app
|
|
36
36
|
|
|
37
|
-
expect(TestApp::Action.config.formats.
|
|
37
|
+
expect(TestApp::Action.config.formats.accepted).to eq []
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it "applies actions config from the app" do
|
|
41
|
-
Hanami.app.config.actions.
|
|
41
|
+
Hanami.app.config.actions.formats.accepted = [:json]
|
|
42
42
|
|
|
43
43
|
prepare_app
|
|
44
44
|
|
|
45
|
-
expect(TestApp::Action.config.formats.
|
|
45
|
+
expect(TestApp::Action.config.formats.accepted).to eq [:json]
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
it "does not override config in the base class" do
|
|
49
|
-
Hanami.app.config.actions.
|
|
49
|
+
Hanami.app.config.actions.formats.accepted = [:csv]
|
|
50
50
|
|
|
51
51
|
prepare_app
|
|
52
52
|
|
|
53
|
-
TestApp::Action.config.
|
|
53
|
+
TestApp::Action.config.formats.accepted = [:json]
|
|
54
54
|
|
|
55
|
-
expect(TestApp::Action.config.formats.
|
|
55
|
+
expect(TestApp::Action.config.formats.accepted).to eq [:json]
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -75,23 +75,23 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
75
75
|
it "applies default actions config from the app", :aggregate_failures do
|
|
76
76
|
prepare_app
|
|
77
77
|
|
|
78
|
-
expect(TestApp::Actions::Articles::Index.config.formats.
|
|
78
|
+
expect(TestApp::Actions::Articles::Index.config.formats.accepted).to eq []
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
it "applies actions config from the app" do
|
|
82
|
-
Hanami.app.config.actions.
|
|
82
|
+
Hanami.app.config.actions.formats.accepted = [:json]
|
|
83
83
|
|
|
84
84
|
prepare_app
|
|
85
85
|
|
|
86
|
-
expect(TestApp::Actions::Articles::Index.config.formats.
|
|
86
|
+
expect(TestApp::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
it "applies config from the base class" do
|
|
90
90
|
prepare_app
|
|
91
91
|
|
|
92
|
-
TestApp::Action.config.
|
|
92
|
+
TestApp::Action.config.formats.accepted = [:json]
|
|
93
93
|
|
|
94
|
-
expect(TestApp::Actions::Articles::Index.config.formats.
|
|
94
|
+
expect(TestApp::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -114,23 +114,23 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
114
114
|
it "applies default actions config from the app", :aggregate_failures do
|
|
115
115
|
prepare_app
|
|
116
116
|
|
|
117
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
117
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq []
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
it "applies actions config from the app" do
|
|
121
|
-
Hanami.app.config.actions.
|
|
121
|
+
Hanami.app.config.actions.formats.accepted = [:json]
|
|
122
122
|
|
|
123
123
|
prepare_app
|
|
124
124
|
|
|
125
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
125
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it "applies config from the base class" do
|
|
129
129
|
prepare_app
|
|
130
130
|
|
|
131
|
-
TestApp::Action.config.
|
|
131
|
+
TestApp::Action.config.formats.accepted = [:json]
|
|
132
132
|
|
|
133
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
133
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
end
|
|
@@ -151,23 +151,23 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
151
151
|
it "applies default actions config from the app", :aggregate_failures do
|
|
152
152
|
prepare_app
|
|
153
153
|
|
|
154
|
-
expect(Admin::Action.config.formats.
|
|
154
|
+
expect(Admin::Action.config.formats.accepted).to eq []
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
it "applies actions config from the app" do
|
|
158
|
-
Hanami.app.config.actions.
|
|
158
|
+
Hanami.app.config.actions.formats.accepted = [:json]
|
|
159
159
|
|
|
160
160
|
prepare_app
|
|
161
161
|
|
|
162
|
-
expect(Admin::Action.config.formats.
|
|
162
|
+
expect(Admin::Action.config.formats.accepted).to eq [:json]
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
it "applies config from the app base class" do
|
|
166
166
|
prepare_app
|
|
167
167
|
|
|
168
|
-
TestApp::Action.config.
|
|
168
|
+
TestApp::Action.config.formats.accepted = [:json]
|
|
169
169
|
|
|
170
|
-
expect(Admin::Action.config.formats.
|
|
170
|
+
expect(Admin::Action.config.formats.accepted).to eq [:json]
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
context "slice actions config present" do
|
|
@@ -186,24 +186,24 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
186
186
|
it "applies actions config from the slice" do
|
|
187
187
|
prepare_app
|
|
188
188
|
|
|
189
|
-
expect(Admin::Action.config.formats.
|
|
189
|
+
expect(Admin::Action.config.formats.accepted).to eq [:csv]
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
it "prefers actions config from the slice over config from the app-level base class" do
|
|
193
193
|
prepare_app
|
|
194
194
|
|
|
195
|
-
TestApp::Action.config.
|
|
195
|
+
TestApp::Action.config.formats.accepted = [:json]
|
|
196
196
|
|
|
197
|
-
expect(Admin::Action.config.formats.
|
|
197
|
+
expect(Admin::Action.config.formats.accepted).to eq [:csv]
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
it "prefers config from the base class over actions config from the slice" do
|
|
201
201
|
prepare_app
|
|
202
202
|
|
|
203
|
-
TestApp::Action.config.
|
|
204
|
-
Admin::Action.config.
|
|
203
|
+
TestApp::Action.config.formats.accepted = [:csv]
|
|
204
|
+
Admin::Action.config.formats.accepted = [:json]
|
|
205
205
|
|
|
206
|
-
expect(Admin::Action.config.formats.
|
|
206
|
+
expect(Admin::Action.config.formats.accepted).to eq [:json]
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
end
|
|
@@ -227,15 +227,15 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
227
227
|
it "applies default actions config from the app", :aggregate_failures do
|
|
228
228
|
prepare_app
|
|
229
229
|
|
|
230
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
230
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq []
|
|
231
231
|
end
|
|
232
232
|
|
|
233
233
|
it "applies actions config from the app" do
|
|
234
|
-
Hanami.app.config.actions.
|
|
234
|
+
Hanami.app.config.actions.formats.accepted = [:json]
|
|
235
235
|
|
|
236
236
|
prepare_app
|
|
237
237
|
|
|
238
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
238
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
it "applies actions config from the slice" do
|
|
@@ -243,7 +243,7 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
243
243
|
write "config/slices/admin.rb", <<~'RUBY'
|
|
244
244
|
module Admin
|
|
245
245
|
class Slice < Hanami::Slice
|
|
246
|
-
config.actions.
|
|
246
|
+
config.actions.formats.accepted = [:json]
|
|
247
247
|
end
|
|
248
248
|
end
|
|
249
249
|
RUBY
|
|
@@ -251,15 +251,15 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
251
251
|
|
|
252
252
|
prepare_app
|
|
253
253
|
|
|
254
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
254
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
255
255
|
end
|
|
256
256
|
|
|
257
257
|
it "applies config from the slice base class" do
|
|
258
258
|
prepare_app
|
|
259
259
|
|
|
260
|
-
Admin::Action.config.
|
|
260
|
+
Admin::Action.config.formats.accepted = [:json]
|
|
261
261
|
|
|
262
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
262
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
263
263
|
end
|
|
264
264
|
|
|
265
265
|
it "prefers config from the slice base class over actions config from the slice" do
|
|
@@ -275,9 +275,9 @@ RSpec.describe "App action / Slice configuration", :app_integration do
|
|
|
275
275
|
|
|
276
276
|
prepare_app
|
|
277
277
|
|
|
278
|
-
Admin::Action.config.
|
|
278
|
+
Admin::Action.config.formats.accepted = [:json]
|
|
279
279
|
|
|
280
|
-
expect(Admin::Actions::Articles::Index.config.formats.
|
|
280
|
+
expect(Admin::Actions::Articles::Index.config.formats.accepted).to eq [:json]
|
|
281
281
|
end
|
|
282
282
|
end
|
|
283
283
|
end
|
|
@@ -65,7 +65,8 @@ RSpec.describe "Hanami web app", :app_integration do
|
|
|
65
65
|
|
|
66
66
|
module TestApp
|
|
67
67
|
class App < Hanami::App
|
|
68
|
-
config.actions.formats.
|
|
68
|
+
config.actions.formats.register :json, "application/json+scim"
|
|
69
|
+
config.actions.formats.accept :json
|
|
69
70
|
config.middleware.use :body_parser, [json: "application/json+scim"]
|
|
70
71
|
config.logger.stream = StringIO.new
|
|
71
72
|
end
|
|
@@ -305,7 +305,7 @@ RSpec.describe "Hanami web app", :app_integration do
|
|
|
305
305
|
expect { Hanami.app.rack_app }.to raise_error do |exception|
|
|
306
306
|
expect(exception).to be_kind_of(Hanami::Routes::MissingActionError)
|
|
307
307
|
expect(exception.message).to include("Could not find action with key \"actions.missing.action\" in TestApp::App")
|
|
308
|
-
expect(exception.message).to
|
|
308
|
+
expect(exception.message).to include("define the action class TestApp::Actions::Missing::Action in app/actions/missing/action.rb")
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
311
|
end
|
|
@@ -337,7 +337,7 @@ RSpec.describe "Hanami web app", :app_integration do
|
|
|
337
337
|
expect { Hanami.app.rack_app }.to raise_error do |exception|
|
|
338
338
|
expect(exception).to be_kind_of(Hanami::Routes::MissingActionError)
|
|
339
339
|
expect(exception.message).to include("Could not find action with key \"actions.missing.action\" in Admin::Slice")
|
|
340
|
-
expect(exception.message).to
|
|
340
|
+
expect(exception.message).to include("define the action class Admin::Actions::Missing::Action in slices/admin/actions/missing/action.rb")
|
|
341
341
|
end
|
|
342
342
|
end
|
|
343
343
|
end
|
|
@@ -23,9 +23,9 @@ RSpec.describe Hanami::Config, "#actions" do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "configures base actions settings using custom methods" do
|
|
26
|
-
expect { actions.formats.
|
|
26
|
+
expect { actions.formats.register(:json, "app/json") }
|
|
27
27
|
.to change { actions.formats.mapping }
|
|
28
|
-
.to include("app/json"
|
|
28
|
+
.to include(json: have_attributes(media_type: "app/json"))
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "can be finalized" do
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hanami
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.0.
|
|
4
|
+
version: 2.3.0.beta2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Hanakai team
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -167,28 +167,28 @@ dependencies:
|
|
|
167
167
|
requirements:
|
|
168
168
|
- - "~>"
|
|
169
169
|
- !ruby/object:Gem::Version
|
|
170
|
-
version: 2.3.0.
|
|
170
|
+
version: 2.3.0.beta2
|
|
171
171
|
type: :runtime
|
|
172
172
|
prerelease: false
|
|
173
173
|
version_requirements: !ruby/object:Gem::Requirement
|
|
174
174
|
requirements:
|
|
175
175
|
- - "~>"
|
|
176
176
|
- !ruby/object:Gem::Version
|
|
177
|
-
version: 2.3.0.
|
|
177
|
+
version: 2.3.0.beta2
|
|
178
178
|
- !ruby/object:Gem::Dependency
|
|
179
179
|
name: hanami-utils
|
|
180
180
|
requirement: !ruby/object:Gem::Requirement
|
|
181
181
|
requirements:
|
|
182
182
|
- - "~>"
|
|
183
183
|
- !ruby/object:Gem::Version
|
|
184
|
-
version:
|
|
184
|
+
version: 2.3.0.beta2
|
|
185
185
|
type: :runtime
|
|
186
186
|
prerelease: false
|
|
187
187
|
version_requirements: !ruby/object:Gem::Requirement
|
|
188
188
|
requirements:
|
|
189
189
|
- - "~>"
|
|
190
190
|
- !ruby/object:Gem::Version
|
|
191
|
-
version:
|
|
191
|
+
version: 2.3.0.beta2
|
|
192
192
|
- !ruby/object:Gem::Dependency
|
|
193
193
|
name: json
|
|
194
194
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -273,9 +273,9 @@ dependencies:
|
|
|
273
273
|
- - "~>"
|
|
274
274
|
- !ruby/object:Gem::Version
|
|
275
275
|
version: '13.0'
|
|
276
|
-
description:
|
|
276
|
+
description: A flexible framework for maintainable Ruby apps
|
|
277
277
|
email:
|
|
278
|
-
-
|
|
278
|
+
- info@hanakai.org
|
|
279
279
|
executables: []
|
|
280
280
|
extensions: []
|
|
281
281
|
extra_rdoc_files: []
|
|
@@ -438,7 +438,6 @@ files:
|
|
|
438
438
|
- spec/integration/view/context/inflector_spec.rb
|
|
439
439
|
- spec/integration/view/context/request_spec.rb
|
|
440
440
|
- spec/integration/view/context/routes_spec.rb
|
|
441
|
-
- spec/integration/view/context/settings_spec.rb
|
|
442
441
|
- spec/integration/view/helpers/form_helper_spec.rb
|
|
443
442
|
- spec/integration/view/helpers/part_helpers_spec.rb
|
|
444
443
|
- spec/integration/view/helpers/scope_helpers_spec.rb
|
|
@@ -493,7 +492,6 @@ files:
|
|
|
493
492
|
- spec/unit/hanami/slice_configurable_spec.rb
|
|
494
493
|
- spec/unit/hanami/slice_name_spec.rb
|
|
495
494
|
- spec/unit/hanami/slice_spec.rb
|
|
496
|
-
- spec/unit/hanami/version_spec.rb
|
|
497
495
|
- spec/unit/hanami/web/rack_logger_spec.rb
|
|
498
496
|
homepage: http://hanamirb.org
|
|
499
497
|
licenses:
|
|
@@ -508,7 +506,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
508
506
|
requirements:
|
|
509
507
|
- - ">="
|
|
510
508
|
- !ruby/object:Gem::Version
|
|
511
|
-
version: '3.
|
|
509
|
+
version: '3.2'
|
|
512
510
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
513
511
|
requirements:
|
|
514
512
|
- - ">="
|
|
@@ -517,7 +515,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
517
515
|
requirements: []
|
|
518
516
|
rubygems_version: 3.6.9
|
|
519
517
|
specification_version: 4
|
|
520
|
-
summary:
|
|
518
|
+
summary: A flexible framework for maintainable Ruby apps
|
|
521
519
|
test_files:
|
|
522
520
|
- spec/integration/action/cookies_spec.rb
|
|
523
521
|
- spec/integration/action/csrf_protection_spec.rb
|
|
@@ -595,7 +593,6 @@ test_files:
|
|
|
595
593
|
- spec/integration/view/context/inflector_spec.rb
|
|
596
594
|
- spec/integration/view/context/request_spec.rb
|
|
597
595
|
- spec/integration/view/context/routes_spec.rb
|
|
598
|
-
- spec/integration/view/context/settings_spec.rb
|
|
599
596
|
- spec/integration/view/helpers/form_helper_spec.rb
|
|
600
597
|
- spec/integration/view/helpers/part_helpers_spec.rb
|
|
601
598
|
- spec/integration/view/helpers/scope_helpers_spec.rb
|
|
@@ -650,5 +647,4 @@ test_files:
|
|
|
650
647
|
- spec/unit/hanami/slice_configurable_spec.rb
|
|
651
648
|
- spec/unit/hanami/slice_name_spec.rb
|
|
652
649
|
- spec/unit/hanami/slice_spec.rb
|
|
653
|
-
- spec/unit/hanami/version_spec.rb
|
|
654
650
|
- spec/unit/hanami/web/rack_logger_spec.rb
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "hanami"
|
|
4
|
-
require "hanami/settings"
|
|
5
|
-
|
|
6
|
-
RSpec.describe "App view / Context / Settings", :app_integration do
|
|
7
|
-
before do
|
|
8
|
-
module TestApp
|
|
9
|
-
class App < Hanami::App
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
class Settings < Hanami::Settings
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
Hanami.prepare
|
|
17
|
-
|
|
18
|
-
module TestApp
|
|
19
|
-
module Views
|
|
20
|
-
class Context < Hanami::View::Context
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
let(:context_class) { TestApp::Views::Context }
|
|
27
|
-
subject(:context) { context_class.new }
|
|
28
|
-
|
|
29
|
-
describe "#settings" do
|
|
30
|
-
it "is the app settings by default" do
|
|
31
|
-
expect(context.settings).to be TestApp::App["settings"]
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context "injected settings" do
|
|
35
|
-
subject(:context) {
|
|
36
|
-
context_class.new(settings: settings)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let(:settings) { double(:settings) }
|
|
40
|
-
|
|
41
|
-
it "is the injected settings" do
|
|
42
|
-
expect(context.settings).to be settings
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|