|
5 | 5 | context "with valid configuration" do
|
6 | 6 | it "returns validated configuration with all optional fields" do
|
7 | 7 | config = {
|
8 |
| - handler_dir: "./custom_handlers", |
| 8 | + handler_plugin_dir: "./custom_handlers", |
9 | 9 | log_level: "debug",
|
10 | 10 | request_limit: 2_048_000,
|
11 | 11 | request_timeout: 45,
|
|
24 | 24 | end
|
25 | 25 |
|
26 | 26 | it "returns validated configuration with minimal fields" do
|
27 |
| - config = {} |
| 27 | + config = { |
| 28 | + handler_plugin_dir: "/path/to/handlers", |
| 29 | + log_level: "info", |
| 30 | + root_path: "/app", |
| 31 | + environment: "development" |
| 32 | + } |
28 | 33 |
|
29 | 34 | result = described_class.validate_global_config(config)
|
30 | 35 |
|
31 |
| - expect(result).to eq({}) |
| 36 | + expect(result).to eq(config) |
32 | 37 | end
|
33 | 38 |
|
34 | 39 | it "accepts production environment" do
|
35 |
| - config = { environment: "production" } |
| 40 | + config = { |
| 41 | + environment: "production", |
| 42 | + handler_plugin_dir: "/path/to/handlers", |
| 43 | + log_level: "info", |
| 44 | + root_path: "/app" |
| 45 | + } |
36 | 46 |
|
37 | 47 | result = described_class.validate_global_config(config)
|
38 | 48 |
|
|
41 | 51 |
|
42 | 52 | it "accepts valid log levels" do
|
43 | 53 | %w[debug info warn error].each do |log_level|
|
44 |
| - config = { log_level: log_level } |
| 54 | + config = { |
| 55 | + log_level: log_level, |
| 56 | + handler_plugin_dir: "/path/to/handlers", |
| 57 | + root_path: "/app", |
| 58 | + environment: "development" |
| 59 | + } |
45 | 60 |
|
46 | 61 | result = described_class.validate_global_config(config)
|
47 | 62 |
|
|
101 | 116 |
|
102 | 117 | it "raises ValidationError for empty string values" do
|
103 | 118 | config = {
|
104 |
| - handler_dir: "", |
| 119 | + handler_plugin_dir: "", |
105 | 120 | root_path: "",
|
106 | 121 | health_path: ""
|
107 | 122 | }
|
|
114 | 129 | it "coerces boolean-like string values" do
|
115 | 130 | config = {
|
116 | 131 | use_catchall_route: "true",
|
117 |
| - normalize_headers: "1" |
| 132 | + normalize_headers: "1", |
| 133 | + handler_plugin_dir: "/path/to/handlers", |
| 134 | + log_level: "info", |
| 135 | + root_path: "/app", |
| 136 | + environment: "development" |
118 | 137 | }
|
119 | 138 |
|
120 | 139 | result = described_class.validate_global_config(config)
|
|
125 | 144 |
|
126 | 145 | it "raises ValidationError for non-string paths" do
|
127 | 146 | config = {
|
128 |
| - handler_dir: 123, |
| 147 | + handler_plugin_dir: 123, |
129 | 148 | root_path: [],
|
130 | 149 | endpoints_dir: {}
|
131 | 150 | }
|
|
138 | 157 | it "coerces string numeric values" do
|
139 | 158 | config = {
|
140 | 159 | request_limit: "1024",
|
141 |
| - request_timeout: "30" |
| 160 | + request_timeout: "30", |
| 161 | + handler_plugin_dir: "/path/to/handlers", |
| 162 | + log_level: "info", |
| 163 | + root_path: "/app", |
| 164 | + environment: "development" |
142 | 165 | }
|
143 | 166 |
|
144 | 167 | result = described_class.validate_global_config(config)
|
|
164 | 187 | end
|
165 | 188 |
|
166 | 189 | it "coerces float values to integers by truncating" do
|
167 |
| - config = { request_timeout: 30.5 } |
| 190 | + config = { |
| 191 | + request_timeout: 30.5, |
| 192 | + handler_plugin_dir: "/path/to/handlers", |
| 193 | + log_level: "info", |
| 194 | + root_path: "/app", |
| 195 | + environment: "development" |
| 196 | + } |
168 | 197 |
|
169 | 198 | result = described_class.validate_global_config(config)
|
170 | 199 |
|
|
0 commit comments