aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json/decoding_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Use appropriate assertion based on expectationCorey Ward2017-01-171-2/+7
| | | | | | | This resolves a stern Minitest “warning” about an upcoming behavior change in MiniTest 6 that will result in the test failing. https://github.com/seattlerb/minitest/issues/666
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-9/+9
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-38/+38
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-10/+10
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-8/+7
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-20/+20
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use correct timezone when parsing date in jsonGrzegorz Witek2016-01-221-5/+11
| | | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/22171 Time specified in ISO 8601 format without `Z` should be considered as local time, yet until now it was treated as UTC. This commit fixes problem by parsing time using timezone specified in application config. The downside of this solution is performance hit (`Time.zone.parse` is ~ 1.6x slower than `Time.parse`), so maybe there's a better solution.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Use with_parse_json_times helper in tests.Zuhao Wan2014-06-221-11/+19
|
* Raise an error when AS::JSON.decode is called with optionsGodfrey Chan2013-10-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 4.1 has switched away from MultiJson, and does not currently support any options on `ActiveSupport::JSON.decode`. Passing in unsupported options (i.e. any non-empty options hash) will now raise an ArgumentError. Rationale: 1. We cannot guarantee the underlying JSON parser won't change in the future, hence we cannot guarantee a consistent set of options the method could take 2. The `json` gem, which happens to be the current JSON parser, takes many dangerous options that is irrelevant to the purpose of AS's JSON decoding API 3. To reserve the options hash for future use, e.g. overriding default global options like ActiveSupport.parse_json_times This change *DOES NOT* introduce any changes in the public API. The signature of the method is still decode(json_text, options). The difference is this method previously accepted undocumented options which does different things when the underlying adapter changes. It now correctly raises an ArgumentError when it encounters options that it does not recognize (and currently it does not support any options).
* Enabled quirks mode on JSON.parse, fixes broken test in af9caaeGodfrey Chan2013-09-121-1/+13
| | | | | | | It turns out that ActionPack depends on the decoder to parse JSON "fragments" (e.g. '"a string"', '1', 'null', etc), so we need to enable quirks mode on JSON.parse. Also added coverage on the decoder side to prevent regression.
* Replace JSON.load with JSON.parse, also removed the proc parameterGodfrey Chan2013-09-111-1/+14
| | | | | | | | | | | | | Since we are dealing with untrusted user input, we should not be using JSON.load. According to the docs[1]: BEWARE: This method is meant to serialise data from trusted user input, like from your own database server or clients under your control, it could be dangerous to allow untrusted users to pass JSON sources into it. The default options for the parser can be changed via the ::load_default_options method. [1] http://www.ruby-doc.org/stdlib-2.0/libdoc/json/rdoc/JSON.html#method-i-load
* Avoid defining multibyte method names in JSON decoding test for JRuby CompatGaurish Sharma2013-08-071-3/+4
| | | | This change is similar to #11736 & in same way switched with fixed string & the index of the hash for method name. the index was added because otherwise, ruby will raise Error.
* Replace multi_json with jsonErik Michaels-Ober2013-05-111-23/+13
|
* Fixed bad tests to clean up after themselves.Ryan Davis2013-05-031-0/+4
|
* Removing extra requires from the test. Already loaded in abstract_unit.Arun Agrawal2011-07-311-1/+0
|
* checked all .rb files in the project tree for missing magic comments, one ↵Xavier Noria2011-07-231-1/+1
| | | | | | | | | | | | | | was missing Came with this one-liner for this: find . -name '*.rb' | \ xargs chardet | \ grep -v ascii | \ cut -d: -f1 -s | \ xargs -n1 ruby -0777 -ne 'puts $FILENAME if $_ !~ /#.*coding:\s*utf/i' Welcome $_.
* AS Json parse_error makes a return for backwards compatibility, although it ↵Josh Kalderimis2011-04-191-1/+1
| | | | will return MultiJson::DecodeError
* removed AS backends and instead rely on MultiJson for json decodingJosh Kalderimis2011-04-181-7/+4
|
* parse dates to yaml in json arraysDiego Carrion2011-03-221-0/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* test json decoding with time parsing disabled with all backends and respect ↵Diego Carrion2011-03-221-4/+2
| | | | | | ActiveSupport.parse_json_times when converting to yaml Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Updated the json date regex to recognize xmlschema formatted date times ↵Josh Kalderimis2011-02-121-0/+4
| | | | | | during json decoding. [#3031 state:resolved] Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
* Fixes an issue when decoding a json string which looks like a date but is ↵Josh Kalderimis2011-02-111-0/+2
| | | | | | invalid. This DateTime parse error is now caught and the original string is instead passed back [#6286 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Fix tests providing valid JSONSantiago Pastorino2011-02-021-2/+2
|
* Fix JSON decoding of newline character with Yaml backend [#3479 state:resolved]Maxime RETY2011-02-021-1/+5
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* use ! " " YAML string literal syntax rather than removing both quotesAaron Patterson2011-01-211-3/+1
|
* Automatically prefer Yajl or JSON backend over Yaml, if availableJeremy Kemper2010-02-051-1/+1
|
* Add yajl-ruby as a JSON parsing backendBrian Lopez2010-02-051-0/+1
| | | | | | [#2666 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Repair time dependenciesJeremy Kemper2009-11-141-0/+1
|
* Clean up spurious JSON decoding test failureJeremy Kemper2009-09-131-8/+2
|
* Fix that JSON parser fails to read escaped backslashes.Daniel Sheppard2009-08-091-3/+5
| | | | | | [#973 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fixed a bug in JSON decoding with Yaml backend, where a combination of ↵Bas Van Klinkenberg2009-08-081-1/+7
| | | | | | dates, escaped or unicode encoded data and arrays would make the parser fail with a ParseError exception. [#2831 state:resolved] Signed-off-by: Yehuda Katz <wycats@gmail.com>
* load the JSON Backend lazily. If the JSON gem is already loaded, use the ↵rick2009-05-171-0/+3
| | | | JSONGem backend by default.
* * Add pluggable JSON backends with support for the JSON gem. [rick]rick2009-04-231-25/+51
| | | | | | | | | | | | | | Example: ActiveSupport::JSON.backend = "JSONGem" All internal Rails JSON encoding is now handled by ActiveSupport::JSON.encode(). Use of #to_json is not recommended, as it may clash with other libraries that overwrite it. However, you can recover Rails specific functionality if you really want to use #to_json. gem 'json' ActiveSupport::JSON.backend = "JSONGem" class ActiveRecord::Base alias to_json rails_to_json end
* Opt in to JSONJeremy Kemper2009-04-221-0/+1
|
* stdlib autoloads were hanging on 1.9.1Jeremy Kemper2009-04-221-2/+2
|
* Reverted affe50105f7027a44eb6e9cfb56f5b3fc070b19b and added more JSON ↵Ubiratan Pires Alberton2009-03-111-1/+3
| | | | | | | | | | decoding tests. Works on Ruby 1.8 and 1.9 [#1100 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Properly decode \u escape sequences in JSON [#1100 state:resolved] [Tim ↵Tim Pope2009-03-101-1/+3
| | | | | | Pope, Philip Hallstrom] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-1/+1
| | | | [#1617 state:resolved]
* Ruby 1.9 compat: fix JSON decoding to work properly with multibyte valuesAkira Matsuda2009-02-171-0/+3
| | | | | | [#1969 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix JSON decoder date-converter regexp [#1662 state:resolved] [Jonathan del ↵Pratik Naik2009-01-071-1/+2
| | | | Strother]
* require abstract_unit directly since test is in load pathJeremy Kemper2008-01-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix JSON encoding/decoding bugs dealing with /'s. Closes #9990 [Rick, ↵Rick Olson2007-10-261-8/+9
| | | | | | theamazingrando] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8026 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Decode json strings as Dates/Times if they're using a YAML-compatible ↵Rick Olson2007-09-241-3/+9
| | | | | | format. Closes #9614 [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7613 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix JSON decoder with nested quotes and commas. Closes #9579.Jeremy Kemper2007-09-171-0/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve various test coverage. Closes #8676 [kamal]Jeremy Kemper2007-06-251-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7117 5ecf4fe2-1ee6-0310-87b1-e25e094e27de