coaster 1.3.25 → 1.3.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 937a250b10e75a66027e94673abfb0c5c4526597d18b8bf4af679c5cd2582e3d
4
- data.tar.gz: e774a2bc8281fe395a26887ff77b425256df396681e80994607791227701cc79
3
+ metadata.gz: 2f6845ad78b984bcd3b7e731c99f301cbb9cf988d2252450b0e961af3de2f630
4
+ data.tar.gz: 00be20732649e4a1176873079b6d23a25bc0e2ead9b204fb7cc2da4ca2862219
5
5
  SHA512:
6
- metadata.gz: 9a1484f822734c3018002842a45604669f461eb37d287f7fb63d51c2f0cf169f6d4fcd63b64e4fa6335c0cfcea95dd14255e56f556f0179f5fcecc7db845999d
7
- data.tar.gz: 2ad1d5bdc02cf154c4e9215d11287885fa1897b9a0b76533d95f528065ce7870101babdb65622c39541e26ee417a4c0d28f7a1a401b0d908c9459fa0f3acc857
6
+ metadata.gz: bc1393903d6481ec4037b3cc71281fbb0d7ae998517065004d281c836effc2e9694e749d8bfe14aea8742e59c92b100002d6c3144cc8926f065d0f6149f13110
7
+ data.tar.gz: 8ed7983c0ffde2f9b0817367187d8b719978adf433f29c7584a2d838176813f204deee4406417f9d5d40f5f05b985230f3e4c60eb05c633accc1ac3055cd07d6
@@ -214,7 +214,7 @@ class StandardError
214
214
  _h
215
215
  end
216
216
 
217
- def to_json
217
+ def to_json(options = {})
218
218
  Oj.dump(to_hash.with_indifferent_access, mode: :compat)
219
219
  end
220
220
 
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '1.3.25'
2
+ VERSION = '1.3.27'
3
3
  end
data/lib/coaster.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'oj'
1
2
  require 'active_support/core_ext/hash/indifferent_access'
2
3
  require 'active_support/core_ext/module/attribute_accessors'
3
4
  require 'active_support/core_ext/class/attribute_accessors'
@@ -316,7 +316,7 @@ LOG
316
316
  assert_equal 'NameError', e.to_hash['type']
317
317
  assert_equal 999999, e.to_hash['status']
318
318
  assert_equal 500, e.to_hash['http_status']
319
- assert_equal "standard error translation (37c30e #{bt})", e.user_message
319
+ assert_equal "standard error translation (bc1746 #{bt})", e.user_message
320
320
  assert_match(/undefined local variable or method `aa'/, e.to_hash['message'])
321
321
  end
322
322
 
@@ -327,6 +327,13 @@ LOG
327
327
  assert_equal 1, e.descriptions['a']
328
328
  end
329
329
 
330
+ def test_to_json
331
+ raise SampleError
332
+ rescue => e
333
+ json = ::JSON.dump({error: e})
334
+ assert_equal "{\"error\":{\"type\":\"Coaster::TestStandardError::SampleError\",\"status\":10,\"http_status\":500,\"message\":\"Coaster::TestStandardError::SampleError\"}}", json
335
+ end
336
+
330
337
  class SampleErrorSub < SampleError; end
331
338
  class SampleErrorSubSub < SampleErrorSub
332
339
  def it_might_happen?; true end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.25
4
+ version: 1.3.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - buzz jung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-16 00:00:00.000000000 Z
11
+ date: 2023-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: i18n
15
29
  requirement: !ruby/object:Gem::Requirement