hanami 2.0.0.beta3 → 2.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/hanami.gemspec +5 -5
  4. data/lib/hanami/app.rb +4 -4
  5. data/lib/hanami/assets/{app_configuration.rb → app_config.rb} +10 -10
  6. data/lib/hanami/assets/{configuration.rb → config.rb} +4 -4
  7. data/lib/hanami/{configuration → config}/actions/content_security_policy.rb +2 -2
  8. data/lib/hanami/{configuration → config}/actions/cookies.rb +6 -5
  9. data/lib/hanami/{configuration → config}/actions/sessions.rb +2 -2
  10. data/lib/hanami/{configuration → config}/actions.rb +11 -12
  11. data/lib/hanami/{configuration → config}/logger.rb +2 -2
  12. data/lib/hanami/config/null_config.rb +14 -0
  13. data/lib/hanami/{configuration → config}/router.rb +8 -8
  14. data/lib/hanami/{configuration → config}/sessions.rb +2 -2
  15. data/lib/hanami/{configuration → config}/views.rb +10 -10
  16. data/lib/hanami/{configuration.rb → config.rb} +19 -19
  17. data/lib/hanami/errors.rb +3 -0
  18. data/lib/hanami/extensions/action/slice_configured_action.rb +1 -1
  19. data/lib/hanami/providers/inflector.rb +0 -2
  20. data/lib/hanami/providers/logger.rb +1 -3
  21. data/lib/hanami/providers/rack.rb +0 -2
  22. data/lib/hanami/providers/routes.rb +0 -2
  23. data/lib/hanami/settings/env_store.rb +3 -3
  24. data/lib/hanami/settings.rb +87 -5
  25. data/lib/hanami/slice/routing/middleware/stack.rb +45 -1
  26. data/lib/hanami/slice.rb +52 -37
  27. data/lib/hanami/slice_configurable.rb +1 -1
  28. data/lib/hanami/slice_registrar.rb +6 -0
  29. data/lib/hanami/version.rb +1 -1
  30. data/lib/hanami.rb +0 -1
  31. data/spec/integration/container/prepare_container_spec.rb +2 -0
  32. data/spec/integration/rack_app/body_parser_spec.rb +108 -0
  33. data/spec/integration/rack_app/middleware_spec.rb +28 -0
  34. data/spec/integration/settings/access_in_slice_class_body_spec.rb +82 -0
  35. data/spec/integration/settings/access_to_constants_spec.rb +23 -146
  36. data/spec/integration/{slices/slice_settings_spec.rb → settings/slice_registration_spec.rb} +5 -1
  37. data/spec/integration/settings/using_types_spec.rb +4 -11
  38. data/spec/support/app_integration.rb +18 -15
  39. data/spec/unit/hanami/{configuration → config}/actions/content_security_policy_spec.rb +10 -10
  40. data/spec/unit/hanami/{configuration → config}/actions/cookies_spec.rb +6 -6
  41. data/spec/unit/hanami/{configuration → config}/actions/csrf_protection_spec.rb +12 -12
  42. data/spec/unit/hanami/config/actions/default_values_spec.rb +54 -0
  43. data/spec/unit/hanami/{configuration → config}/actions/sessions_spec.rb +5 -5
  44. data/spec/unit/hanami/{configuration → config}/actions_spec.rb +9 -10
  45. data/spec/unit/hanami/{configuration → config}/base_url_spec.rb +2 -2
  46. data/spec/unit/hanami/{configuration → config}/inflector_spec.rb +2 -2
  47. data/spec/unit/hanami/{configuration → config}/logger_spec.rb +4 -4
  48. data/spec/unit/hanami/{configuration → config}/router_spec.rb +7 -8
  49. data/spec/unit/hanami/{configuration → config}/slices_spec.rb +2 -2
  50. data/spec/unit/hanami/{configuration → config}/views_spec.rb +11 -12
  51. data/spec/unit/hanami/{configuration_spec.rb → config_spec.rb} +3 -3
  52. data/spec/unit/hanami/settings_spec.rb +65 -10
  53. data/spec/unit/hanami/slice_configurable_spec.rb +21 -2
  54. data/spec/unit/hanami/version_spec.rb +1 -1
  55. metadata +73 -58
  56. data/lib/hanami/configuration/null_configuration.rb +0 -14
  57. data/lib/hanami/providers/settings.rb +0 -98
  58. data/spec/unit/hanami/configuration/actions/default_values_spec.rb +0 -52
@@ -9,161 +9,38 @@ RSpec.describe "Settings / Access to constants", :app_integration do
9
9
  ENV.replace(@env)
10
10
  end
11
11
 
12
- describe "Settings can access autoloadable constants" do
13
- describe "settings for app" do
14
- specify "constant defined in app directory" do
15
- with_directory(make_tmp_directory) do
16
- write "config/app.rb", <<~'RUBY'
17
- require "hanami"
18
-
19
- module TestApp
20
- class App < Hanami::App
21
- end
22
- end
23
- RUBY
24
-
25
- write ".env", <<~'TEXT'
26
- SOME_FLAG=true
27
- TEXT
28
-
29
- write "config/settings.rb", <<~'RUBY'
30
- module TestApp
31
- class Settings < Hanami::Settings
32
- setting :some_flag, constructor: Types::Params::Bool
33
- end
34
- end
35
- RUBY
36
-
37
- write "app/types.rb", <<~'RUBY'
38
- # auto_register: false
39
-
40
- require "dry/types"
41
-
42
- module TestApp
43
- Types = Dry.Types()
44
- end
45
- RUBY
46
-
47
- require "hanami/prepare"
48
-
49
- expect(Hanami.app[:settings].some_flag).to be true
12
+ specify "Settings can not access autoloadable constants" do
13
+ with_directory(make_tmp_directory) do
14
+ write "config/app.rb", <<~'RUBY'
15
+ require "hanami"
16
+
17
+ module TestApp
18
+ class App < Hanami::App
19
+ end
50
20
  end
51
- end
52
-
53
- specify "constant defined in root lib directory" do
54
- with_directory(make_tmp_directory) do
55
- write "config/app.rb", <<~'RUBY'
56
- require "hanami"
57
-
58
- module TestApp
59
- class App < Hanami::App
60
- end
61
- end
62
- RUBY
63
-
64
- write ".env", <<~'TEXT'
65
- SOME_FLAG=true
66
- TEXT
67
-
68
- write "config/settings.rb", <<~'RUBY'
69
- module TestApp
70
- class Settings < Hanami::Settings
71
- setting :some_flag, constructor: Types::Params::Bool
72
- end
73
- end
74
- RUBY
75
-
76
- write "lib/test_app/types.rb", <<~'RUBY'
77
- require "dry/types"
78
-
79
- module TestApp
80
- Types = Dry.Types()
81
- end
82
- RUBY
83
-
84
- require "hanami/prepare"
21
+ RUBY
85
22
 
86
- expect(Hanami.app[:settings].some_flag).to be true
23
+ write "config/settings.rb", <<~'RUBY'
24
+ module TestApp
25
+ class Settings < Hanami::Settings
26
+ setting :some_flag, constructor: TestApp::Types::Params::Bool
27
+ end
87
28
  end
88
- end
89
- end
90
-
91
- describe "settings for slice" do
92
- specify "constant defined in slice directory" do
93
- with_directory(make_tmp_directory) do
94
- write "config/app.rb", <<~'RUBY'
95
- require "hanami"
96
-
97
- module TestApp
98
- class App < Hanami::App
99
- end
100
- end
101
- RUBY
102
-
103
- write ".env", <<~'TEXT'
104
- SOME_FLAG=true
105
- TEXT
106
-
107
- write "slices/main/config/settings.rb", <<~'RUBY'
108
- module Main
109
- class Settings < Hanami::Settings
110
- setting :some_flag, constructor: Types::Params::Bool
111
- end
112
- end
113
- RUBY
114
-
115
- write "slices/main/types.rb", <<~'RUBY'
116
- # auto_register: false
117
-
118
- require "dry/types"
29
+ RUBY
119
30
 
120
- module Main
121
- Types = Dry.Types()
122
- end
123
- RUBY
31
+ write "app/types.rb", <<~'RUBY'
32
+ # auto_register: false
124
33
 
125
- require "hanami/prepare"
34
+ require "dry/types"
126
35
 
127
- expect(Main::Slice[:settings].some_flag).to be true
36
+ module TestApp
37
+ Types = Dry.Types()
128
38
  end
129
- end
39
+ RUBY
130
40
 
131
- specify "constant defined in root lib directory" do
132
- with_directory(make_tmp_directory) do
133
- write "config/app.rb", <<~'RUBY'
134
- require "hanami"
41
+ require "hanami/setup"
135
42
 
136
- module TestApp
137
- class App < Hanami::App
138
- end
139
- end
140
- RUBY
141
-
142
- write ".env", <<~'TEXT'
143
- SOME_FLAG=true
144
- TEXT
145
-
146
- write "slices/main/config/settings.rb", <<~'RUBY'
147
- module Main
148
- class Settings < Hanami::Settings
149
- setting :some_flag, constructor: TestApp::Types::Params::Bool
150
- end
151
- end
152
- RUBY
153
-
154
- write "lib/test_app/types.rb", <<~'RUBY'
155
- require "dry/types"
156
-
157
- module TestApp
158
- Types = Dry.Types()
159
- end
160
- RUBY
161
-
162
- require "hanami/prepare"
163
-
164
- expect(Main::Slice[:settings].some_flag).to be true
165
- end
166
- end
43
+ expect { Hanami.app.settings }.to raise_error(NameError, /TestApp::Types/)
167
44
  end
168
45
  end
169
46
  end
@@ -1,4 +1,6 @@
1
- RSpec.describe "Slices / Slice settings", :app_integration do
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe "Settings / Slice registration", :app_integration do
2
4
  specify "Settings are registered for each slice with a settings file" do
3
5
  with_tmp_directory(Dir.mktmpdir) do
4
6
  write "config/app.rb", <<~RUBY
@@ -10,6 +12,8 @@ RSpec.describe "Slices / Slice settings", :app_integration do
10
12
  end
11
13
  RUBY
12
14
 
15
+ # n.b. no app-level settings file
16
+
13
17
  # The main slice has settings
14
18
  write "slices/main/config/settings.rb", <<~RUBY
15
19
  # frozen_string_literal: true
@@ -11,7 +11,7 @@ RSpec.describe "Settings / Using types", :app_integration do
11
11
  ENV.replace(@env)
12
12
  end
13
13
 
14
- specify "dry-types can be used as setting constructors to coerce values" do
14
+ specify "types from a provided types module can be used as setting constructors to coerce values" do
15
15
  with_tmp_directory(Dir.mktmpdir) do
16
16
  write "config/app.rb", <<~RUBY
17
17
  require "hanami"
@@ -23,14 +23,12 @@ RSpec.describe "Settings / Using types", :app_integration do
23
23
  RUBY
24
24
 
25
25
  write "config/settings.rb", <<~RUBY
26
- require "dry/types"
27
-
28
26
  module TestApp
29
27
  class Settings < Hanami::Settings
30
- Types = Dry.Types()
28
+ Bool = Types::Params::Bool
31
29
 
32
30
  setting :numeric, constructor: Types::Params::Integer
33
- setting :flag, constructor: Types::Params::Bool
31
+ setting :flag, constructor: Bool
34
32
  end
35
33
  end
36
34
  RUBY
@@ -45,7 +43,7 @@ RSpec.describe "Settings / Using types", :app_integration do
45
43
  end
46
44
  end
47
45
 
48
- specify "errors raised from setting constructors are collected and re-raised in aggregate" do
46
+ specify "errors raised from setting constructors are collected and re-raised in aggregate, and will prevent the app from booting" do
49
47
  with_tmp_directory(Dir.mktmpdir) do
50
48
  write "config/app.rb", <<~RUBY
51
49
  require "hanami"
@@ -57,12 +55,8 @@ RSpec.describe "Settings / Using types", :app_integration do
57
55
  RUBY
58
56
 
59
57
  write "config/settings.rb", <<~RUBY
60
- require "dry/types"
61
-
62
58
  module TestApp
63
59
  class Settings < Hanami::Settings
64
- Types = Dry.Types()
65
-
66
60
  setting :numeric, constructor: Types::Params::Integer
67
61
  setting :flag, constructor: Types::Params::Bool
68
62
  end
@@ -83,5 +77,4 @@ RSpec.describe "Settings / Using types", :app_integration do
83
77
  )
84
78
  end
85
79
  end
86
-
87
80
  end
@@ -23,6 +23,23 @@ RSpec.shared_context "Application integration" do
23
23
  let(:app_modules) { %i[TestApp Admin Main Search] }
24
24
  end
25
25
 
26
+ def autoloaders_teardown!
27
+ # Tear down Zeitwerk (from zeitwerk's own test/support/loader_test)
28
+ Zeitwerk::Registry.loaders.reject! do |loader|
29
+ test_loader = loader.dirs.any? { |dir|
30
+ dir.include?("/spec/") || dir.include?(Dir.tmpdir) ||
31
+ dir.include?("/slices/") || dir.include?("/app")
32
+ }
33
+
34
+ if test_loader
35
+ loader.unregister
36
+ true
37
+ else
38
+ false
39
+ end
40
+ end
41
+ end
42
+
26
43
  RSpec.configure do |config|
27
44
  config.include RSpec::Support::Files, :app_integration
28
45
  config.include RSpec::Support::WithTmpDirectory, :app_integration
@@ -36,21 +53,7 @@ RSpec.configure do |config|
36
53
  end
37
54
 
38
55
  config.after :each, :app_integration do
39
- # Tear down Zeitwerk (from zeitwerk's own test/support/loader_test)
40
- Zeitwerk::Registry.loaders.each(&:unload)
41
- Zeitwerk::Registry.loaders.clear
42
-
43
- # This private interface changes between 2.5.4 and 2.6.0
44
- if Zeitwerk::Registry.respond_to?(:loaders_managing_gems)
45
- Zeitwerk::Registry.loaders_managing_gems.clear
46
- else
47
- Zeitwerk::Registry.gem_loaders_by_root_file.clear
48
- Zeitwerk::Registry.autoloads.clear
49
- Zeitwerk::Registry.inceptions.clear
50
- end
51
-
52
- Zeitwerk::ExplicitNamespace.cpaths.clear
53
- Zeitwerk::ExplicitNamespace.tracer.disable
56
+ autoloaders_teardown!
54
57
 
55
58
  Hanami.instance_variable_set(:@_bundled, {})
56
59
  Hanami.remove_instance_variable(:@_app) if Hanami.instance_variable_defined?(:@_app)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration/actions"
3
+ require "hanami/config/actions"
4
4
 
5
- RSpec.describe Hanami::Configuration::Actions, "#content_security_policy" do
6
- let(:configuration) { described_class.new }
7
- subject(:content_security_policy) { configuration.content_security_policy }
5
+ RSpec.describe Hanami::Config::Actions, "#content_security_policy" do
6
+ let(:config) { described_class.new }
7
+ subject(:content_security_policy) { config.content_security_policy }
8
8
 
9
9
  context "no CSP config specified" do
10
10
  context "without assets_server_url" do
@@ -34,7 +34,7 @@ RSpec.describe Hanami::Configuration::Actions, "#content_security_policy" do
34
34
  end
35
35
 
36
36
  context "with assets_server_url" do
37
- let(:configuration) { described_class.new(assets_server_url: assets_server_url) }
37
+ let(:config) { described_class.new(assets_server_url: assets_server_url) }
38
38
  let(:assets_server_url) { "http://localhost:8080" }
39
39
 
40
40
  it "includes server url" do
@@ -85,18 +85,18 @@ RSpec.describe Hanami::Configuration::Actions, "#content_security_policy" do
85
85
 
86
86
  context "with CSP enabled" do
87
87
  it "sets default header" do
88
- configuration.finalize!
88
+ config.finalize!
89
89
 
90
- expect(configuration.default_headers.fetch("Content-Security-Policy")).to eq(content_security_policy.to_str)
90
+ expect(config.default_headers.fetch("Content-Security-Policy")).to eq(content_security_policy.to_str)
91
91
  end
92
92
  end
93
93
 
94
94
  context "with CSP disabled" do
95
95
  it "doesn't set default header" do
96
- configuration.content_security_policy = false
97
- configuration.finalize!
96
+ config.content_security_policy = false
97
+ config.finalize!
98
98
 
99
- expect(configuration.default_headers.key?("Content-Security-Policy")).to be(false)
99
+ expect(config.default_headers.key?("Content-Security-Policy")).to be(false)
100
100
  end
101
101
  end
102
102
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration/actions"
3
+ require "hanami/config/actions"
4
4
 
5
- RSpec.describe Hanami::Configuration::Actions, "#cookies" do
6
- let(:configuration) { described_class.new }
7
- subject(:cookies) { configuration.cookies }
5
+ RSpec.describe Hanami::Config::Actions, "#cookies" do
6
+ let(:config) { described_class.new }
7
+ subject(:cookies) { config.cookies }
8
8
 
9
9
  context "default config" do
10
10
  it "is enabled" do
@@ -18,7 +18,7 @@ RSpec.describe Hanami::Configuration::Actions, "#cookies" do
18
18
 
19
19
  context "options given" do
20
20
  before do
21
- configuration.cookies = {max_age: 300}
21
+ config.cookies = {max_age: 300}
22
22
  end
23
23
 
24
24
  it "is enabled" do
@@ -32,7 +32,7 @@ RSpec.describe Hanami::Configuration::Actions, "#cookies" do
32
32
 
33
33
  context "nil value given" do
34
34
  before do
35
- configuration.cookies = nil
35
+ config.cookies = nil
36
36
  end
37
37
 
38
38
  it "is not enabled" do
@@ -1,32 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration/actions"
3
+ require "hanami/config/actions"
4
4
 
5
- RSpec.describe Hanami::Configuration::Actions, "#csrf_protection" do
6
- let(:configuration) { described_class.new }
7
- subject(:value) { configuration.csrf_protection }
5
+ RSpec.describe Hanami::Config::Actions, "#csrf_protection" do
6
+ let(:config) { described_class.new }
7
+ subject(:value) { config.csrf_protection }
8
8
 
9
- context "non-finalized configuration" do
9
+ context "non-finalized config" do
10
10
  it "returns a default of nil" do
11
11
  is_expected.to be_nil
12
12
  end
13
13
 
14
14
  it "can be explicitly enabled" do
15
- configuration.csrf_protection = true
15
+ config.csrf_protection = true
16
16
  is_expected.to be true
17
17
  end
18
18
 
19
19
  it "can be explicitly disabled" do
20
- configuration.csrf_protection = false
20
+ config.csrf_protection = false
21
21
  is_expected.to be false
22
22
  end
23
23
  end
24
24
 
25
- context "finalized configuration" do
25
+ context "finalized config" do
26
26
  context "sessions enabled" do
27
27
  before do
28
- configuration.sessions = :cookie, {secret: "abc"}
29
- configuration.finalize!
28
+ config.sessions = :cookie, {secret: "abc"}
29
+ config.finalize!
30
30
  end
31
31
 
32
32
  it "is true" do
@@ -35,7 +35,7 @@ RSpec.describe Hanami::Configuration::Actions, "#csrf_protection" do
35
35
 
36
36
  context "explicitly disabled" do
37
37
  before do
38
- configuration.csrf_protection = false
38
+ config.csrf_protection = false
39
39
  end
40
40
 
41
41
  it "is false" do
@@ -46,7 +46,7 @@ RSpec.describe Hanami::Configuration::Actions, "#csrf_protection" do
46
46
 
47
47
  context "sessions not enabled" do
48
48
  before do
49
- configuration.finalize!
49
+ config.finalize!
50
50
  end
51
51
 
52
52
  it "is true" do
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/config/actions"
4
+
5
+ RSpec.describe Hanami::Config::Actions, "default values" do
6
+ subject(:config) { described_class.new }
7
+
8
+ describe "sessions" do
9
+ specify { expect(config.sessions).not_to be_enabled }
10
+ end
11
+
12
+ describe "name_inference_base" do
13
+ specify { expect(config.name_inference_base).to eq "actions" }
14
+ end
15
+
16
+ describe "view_context_identifier" do
17
+ specify { expect(config.view_context_identifier).to eq "views.context" }
18
+ end
19
+
20
+ describe "view_name_inferrer" do
21
+ specify { expect(config.view_name_inferrer).to eq Hanami::Slice::ViewNameInferrer }
22
+ end
23
+
24
+ describe "view_name_inference_base" do
25
+ specify { expect(config.view_name_inference_base).to eq "views" }
26
+ end
27
+
28
+ describe "new default values applied to base action settings" do
29
+ describe "default_request_format" do
30
+ specify { expect(config.default_request_format).to eq :html }
31
+ end
32
+
33
+ describe "default_response_format" do
34
+ specify { expect(config.default_response_format).to eq :html }
35
+ end
36
+
37
+ describe "content_security_policy" do
38
+ specify { expect(config.content_security_policy).to be_kind_of(Hanami::Config::Actions::ContentSecurityPolicy) }
39
+ end
40
+
41
+ describe "default_headers" do
42
+ specify {
43
+ config.finalize!
44
+
45
+ expect(config.default_headers).to eq(
46
+ "X-Frame-Options" => "DENY",
47
+ "X-Content-Type-Options" => "nosniff",
48
+ "X-XSS-Protection" => "1; mode=block",
49
+ "Content-Security-Policy" => config.content_security_policy.to_str
50
+ )
51
+ }
52
+ end
53
+ end
54
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration/actions"
3
+ require "hanami/config/actions"
4
4
 
5
- RSpec.describe Hanami::Configuration::Actions, "#sessions" do
6
- let(:configuration) { described_class.new }
7
- subject(:sessions) { configuration.sessions }
5
+ RSpec.describe Hanami::Config::Actions, "#sessions" do
6
+ let(:config) { described_class.new }
7
+ subject(:sessions) { config.sessions }
8
8
 
9
9
  context "no session config specified" do
10
10
  it "is not enabled" do
@@ -26,7 +26,7 @@ RSpec.describe Hanami::Configuration::Actions, "#sessions" do
26
26
 
27
27
  context "valid session config provided" do
28
28
  before do
29
- configuration.sessions = :cookie, {secret: "abc"}
29
+ config.sessions = :cookie, {secret: "abc"}
30
30
  end
31
31
 
32
32
  it "is enabled" do
@@ -1,18 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration"
4
- require "hanami/configuration/actions"
5
- require "hanami/action/configuration"
3
+ require "hanami/config"
4
+ require "hanami/action"
6
5
 
7
- RSpec.describe Hanami::Configuration, "#actions" do
8
- let(:configuration) { described_class.new(app_name: app_name, env: :development) }
6
+ RSpec.describe Hanami::Config, "#actions" do
7
+ let(:config) { described_class.new(app_name: app_name, env: :development) }
9
8
  let(:app_name) { "MyApp::app" }
10
9
 
11
- subject(:actions) { configuration.actions }
10
+ subject(:actions) { config.actions }
12
11
 
13
12
  context "hanami-controller is bundled" do
14
- it "is a full actions configuration" do
15
- is_expected.to be_an_instance_of(Hanami::Configuration::Actions)
13
+ it "is a full actions config" do
14
+ is_expected.to be_an_instance_of(Hanami::Config::Actions)
16
15
 
17
16
  is_expected.to respond_to(:default_response_format)
18
17
  is_expected.to respond_to(:default_response_format=)
@@ -43,7 +42,7 @@ RSpec.describe Hanami::Configuration, "#actions" do
43
42
  end
44
43
 
45
44
  it "includes all base action settings" do
46
- expect(actions.settings).to include(Hanami::Action::Configuration.settings)
45
+ expect(actions.settings).to include(Hanami::Action.settings)
47
46
  end
48
47
  end
49
48
  end
@@ -55,7 +54,7 @@ RSpec.describe Hanami::Configuration, "#actions" do
55
54
  end
56
55
 
57
56
  it "does not expose any settings" do
58
- is_expected.not_to be_an_instance_of(Hanami::Configuration::Actions)
57
+ is_expected.not_to be_an_instance_of(Hanami::Config::Actions)
59
58
  is_expected.not_to respond_to(:default_response_format)
60
59
  is_expected.not_to respond_to(:default_response_format=)
61
60
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration"
3
+ require "hanami/config"
4
4
  require "uri"
5
5
 
6
- RSpec.describe Hanami::Configuration, "base_url" do
6
+ RSpec.describe Hanami::Config, "base_url" do
7
7
  subject(:config) { described_class.new(app_name: app_name, env: :development) }
8
8
  let(:app_name) { "MyApp::app" }
9
9
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration"
3
+ require "hanami/config"
4
4
 
5
- RSpec.describe Hanami::Configuration do
5
+ RSpec.describe Hanami::Config do
6
6
  subject(:config) { described_class.new(app_name: app_name, env: :development) }
7
7
  let(:app_name) { "MyApp::app" }
8
8
 
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration/logger"
3
+ require "hanami/config/logger"
4
4
  require "hanami/slice_name"
5
5
  require "dry/inflector"
6
6
  require "logger"
7
7
 
8
- RSpec.describe Hanami::Configuration::Logger do
8
+ RSpec.describe Hanami::Config::Logger do
9
9
  subject { described_class.new(app_name: app_name, env: env) }
10
10
  let(:app_name) { Hanami::SliceName.new(double(name: "MyApp::app"), inflector: -> { Dry::Inflector.new }) }
11
11
  let(:env) { :development }
@@ -165,7 +165,7 @@ RSpec.describe Hanami::Configuration::Logger do
165
165
  end
166
166
  end
167
167
 
168
- RSpec.describe Hanami::Configuration do
168
+ RSpec.describe Hanami::Config do
169
169
  subject(:config) { described_class.new(app_name: app_name, env: env) }
170
170
  let(:app_name) { Hanami::SliceName.new(double(name: "SOS::app"), inflector: -> { Dry::Inflector.new }) }
171
171
  let(:env) { :development }
@@ -180,7 +180,7 @@ RSpec.describe Hanami::Configuration do
180
180
  end
181
181
 
182
182
  describe "#app_name" do
183
- it "defaults to Hanami::Configuration#app_name" do
183
+ it "defaults to Hanami::Config#app_name" do
184
184
  expect(config.logger.app_name).to eq(config.app_name)
185
185
  end
186
186
  end
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "hanami/configuration"
4
- require "hanami/configuration/router"
3
+ require "hanami/config"
5
4
 
6
- RSpec.describe Hanami::Configuration, "#router" do
7
- let(:configuration) { described_class.new(app_name: app_name, env: :development) }
5
+ RSpec.describe Hanami::Config, "#router" do
6
+ let(:config) { described_class.new(app_name: app_name, env: :development) }
8
7
  let(:app_name) { "MyApp::app" }
9
8
 
10
- subject(:router) { configuration.router }
9
+ subject(:router) { config.router }
11
10
 
12
11
  context "hanami-router is bundled" do
13
12
  it "is a full router configuration" do
14
- is_expected.to be_an_instance_of(Hanami::Configuration::Router)
13
+ is_expected.to be_an_instance_of(Hanami::Config::Router)
15
14
 
16
15
  is_expected.to respond_to(:resolver)
17
16
  end
@@ -19,7 +18,7 @@ RSpec.describe Hanami::Configuration, "#router" do
19
18
  it "loads the middleware stack" do
20
19
  subject
21
20
 
22
- expect(configuration.middleware_stack).not_to be_nil
21
+ expect(config.middleware_stack).not_to be_nil
23
22
  end
24
23
 
25
24
  it "can be finalized" do
@@ -34,7 +33,7 @@ RSpec.describe Hanami::Configuration, "#router" do
34
33
  end
35
34
 
36
35
  it "does not expose any settings" do
37
- is_expected.not_to be_an_instance_of(Hanami::Configuration::Router)
36
+ is_expected.not_to be_an_instance_of(Hanami::Config::Router)
38
37
  is_expected.not_to respond_to(:resolver)
39
38
  end
40
39