Skip to content

Commit 1e47eb5

Browse files
authored
Merge pull request #3805 from AlchemyCMS/fix-configuration-to_json
fix(Configuration): Delegate to_json to to_h
2 parents 4508600 + bbc39c4 commit 1e47eb5

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

lib/alchemy/configuration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def to_h
6868
).to_h
6969
end
7070

71+
delegate :to_json, to: :to_h
72+
7173
class << self
7274
def defined_configurations = []
7375

spec/libraries/alchemy/configuration_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@
290290
uploader: {file_size_limit: 100, upload_limit: 50}
291291
)
292292
end
293+
294+
it "can be converted to JSON" do
295+
expect(configuration.to_json).to eq(
296+
'{"uploader":{"file_size_limit":100,"upload_limit":50}}'
297+
)
298+
end
293299
end
294300

295301
describe "#preview_sources" do

0 commit comments

Comments
 (0)