class TestJSONDecoding

Constants

TESTS

Public Instance Methods

test_cannot_pass_unsupported_options() click to toggle source
# File activesupport/test/json/decoding_test.rb, line 111
def test_cannot_pass_unsupported_options
  assert_raise(ArgumentError) { ActiveSupport::JSON.decode("", create_additions: true) }
end
test_failed_json_decoding() click to toggle source
# File activesupport/test/json/decoding_test.rb, line 104
def test_failed_json_decoding
  assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%(undefined)) }
  assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%({a: 1})) }
  assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%({: 1})) }
  assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%()) }
end

Private Instance Methods

with_parse_json_times(value) { || ... } click to toggle source
# File activesupport/test/json/decoding_test.rb, line 117
def with_parse_json_times(value)
  old_value = ActiveSupport.parse_json_times
  ActiveSupport.parse_json_times = value
  yield
ensure
  ActiveSupport.parse_json_times = old_value
end