diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 405528e4e1..419bab8967 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,4 +1,4 @@ -* Rescue `JSON::ParserError` in Cookies json deserializer to discards marshal dumps: +* Rescue `JSON::ParserError` in Cookies JSON deserializer to discards marshal dumps: Without this change, if `action_dispatch.cookies_serializer` is set to `:json` and the app tries to read a `:marshal` serialized cookie, it would error out which wouldn't diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index 5a95f09a1e..b25f43e791 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -18,28 +18,28 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest TestController.last_request_parameters = nil end - test "parses json params for application json" do + test "parses JSON params for application JSON" do assert_parses( { "person" => { "name" => "David" } }, "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/json" ) end - test "parses boolean and number json params for application json" do + test "parses boolean and number JSON params for application JSON" do assert_parses( { "item" => { "enabled" => false, "count" => 10 } }, "{\"item\": {\"enabled\": false, \"count\": 10}}", "CONTENT_TYPE" => "application/json" ) end - test "parses json params for application jsonrequest" do + test "parses JSON params for application jsonrequest" do assert_parses( { "person" => { "name" => "David" } }, "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/jsonrequest" ) end - test "parses json params for application problem+json" do + test "parses JSON params for application problem+json" do assert_parses( { "person" => { "name" => "David" } }, "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/problem+json" @@ -140,35 +140,35 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest UsersController.last_request_parameters = nil end - test "parses json params for application json" do + test "parses JSON params for application JSON" do assert_parses( { "user" => { "username" => "sikachu" }, "username" => "sikachu" }, "{\"username\": \"sikachu\"}", "CONTENT_TYPE" => "application/json" ) end - test "parses json params for application jsonrequest" do + test "parses JSON params for application jsonrequest" do assert_parses( { "user" => { "username" => "sikachu" }, "username" => "sikachu" }, "{\"username\": \"sikachu\"}", "CONTENT_TYPE" => "application/jsonrequest" ) end - test "parses json params for application problem+json" do + test "parses JSON params for application problem+json" do assert_parses( { "user" => { "username" => "sikachu" }, "username" => "sikachu" }, "{\"username\": \"sikachu\"}", "CONTENT_TYPE" => "application/problem+json" ) end - test "parses json with non-object JSON content" do + test "parses JSON with non-object JSON content" do assert_parses( { "user" => { "_json" => "string content" }, "_json" => "string content" }, "\"string content\"", "CONTENT_TYPE" => "application/json" ) end - test "parses json params after custom json mime type registered" do + test "parses JSON params after custom JSON mime type registered" do Mime::Type.unregister :json Mime::Type.register "application/json", :json, %w(application/vnd.rails+json) assert_parses( @@ -180,7 +180,7 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest application/problem+json ) end - test "parses json params after custom json mime type registered with synonym" do + test "parses JSON params after custom JSON mime type registered with synonym" do Mime::Type.unregister :json Mime::Type.register "application/json", :json, %w(application/vnd.rails+json) assert_parses( diff --git a/actionview/test/ujs/public/vendor/jquery-2.2.0.js b/actionview/test/ujs/public/vendor/jquery-2.2.0.js index 4b16326bd7..b26b660667 100644 --- a/actionview/test/ujs/public/vendor/jquery-2.2.0.js +++ b/actionview/test/ujs/public/vendor/jquery-2.2.0.js @@ -8315,7 +8315,7 @@ jQuery.extend( { // Text to html (true = no transformation) "text html": true, - // Evaluate text as a json expression + // Evaluate text as a JSON expression "text json": jQuery.parseJSON, // Parse text as xml @@ -9295,7 +9295,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } - // Use data converter to retrieve json after script execution + // Use data converter to retrieve JSON after script execution s.converters[ "script json" ] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); @@ -9303,7 +9303,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { return responseContainer[ 0 ]; }; - // Force json dataType + // Force JSON dataType s.dataTypes[ 0 ] = "json"; // Install callback diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 1ebb6e7b3b..288e04af26 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -215,7 +215,7 @@ module ActiveModel # Returns a Hash that can be used as the JSON representation for this # object. You can pass the :full_messages option. This determines - # if the json object should contain full messages or not (false by default). + # if the JSON object should contain full messages or not (false by default). # # person.errors.as_json # => {:name=>["cannot be nil"]} # person.errors.as_json(full_messages: true) # => {:name=>["name cannot be nil"]} diff --git a/activemodel/test/cases/serializers/json_serialization_test.rb b/activemodel/test/cases/serializers/json_serialization_test.rb index 55851aba26..3ac7f5feb3 100644 --- a/activemodel/test/cases/serializers/json_serialization_test.rb +++ b/activemodel/test/cases/serializers/json_serialization_test.rb @@ -14,7 +14,7 @@ class JsonSerializationTest < ActiveModel::TestCase @contact.preferences = { "shows" => "anime" } end - test "should not include root in json (class method)" do + test "should not include root in JSON (class method)" do json = @contact.to_json assert_no_match %r{^\{"contact":\{}, json @@ -25,7 +25,7 @@ class JsonSerializationTest < ActiveModel::TestCase assert_match %r{"preferences":\{"shows":"anime"\}}, json end - test "should include root in json if include_root_in_json is true" do + test "should include root in JSON if include_root_in_json is true" do original_include_root_in_json = Contact.include_root_in_json Contact.include_root_in_json = true json = @contact.to_json @@ -40,19 +40,19 @@ class JsonSerializationTest < ActiveModel::TestCase Contact.include_root_in_json = original_include_root_in_json end - test "should include root in json (option) even if the default is set to false" do + test "should include root in JSON (option) even if the default is set to false" do json = @contact.to_json(root: true) assert_match %r{^\{"contact":\{}, json end - test "should not include root in json (option)" do + test "should not include root in JSON (option)" do json = @contact.to_json(root: false) assert_no_match %r{^\{"contact":\{}, json end - test "should include custom root in json" do + test "should include custom root in JSON" do json = @contact.to_json(root: "json_contact") assert_match %r{^\{"json_contact":\{}, json @@ -198,7 +198,7 @@ class JsonSerializationTest < ActiveModel::TestCase assert_no_match %r{"preferences":}, json end - test "Class.model_name should be json encodable" do + test "Class.model_name should be JSON encodable" do assert_match %r{"Contact"}, Contact.model_name.to_json end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 6070a51015..f1c93ae6f5 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -450,7 +450,7 @@ module ActiveRecord false end - # Does this adapter support json data type? + # Does this adapter support JSON data type? def supports_json? false end diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index e3ab2d5017..2663a7344a 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -530,7 +530,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_predicate topic, :user_defined_time? end - test "user-defined json attribute predicate" do + test "user-defined JSON attribute predicate" do klass = Class.new(ActiveRecord::Base) do self.table_name = Topic.table_name diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index bd9b6f9019..515e229514 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Hack to load json gem first so we can override its to_json. +# Hack to load JSON gem first so we can override its to_json. require "json" require "bigdecimal" require "ipaddr" diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb index 80eb4e9f30..78016bdd22 100644 --- a/activesupport/lib/active_support/json/decoding.rb +++ b/activesupport/lib/active_support/json/decoding.rb @@ -5,7 +5,7 @@ require "active_support/core_ext/module/delegation" require "json" module ActiveSupport - # Look for and parse json strings that look like ISO 8601 times. + # Look for and parse JSON strings that look like ISO 8601 times. mattr_accessor :parse_json_times module JSON diff --git a/activesupport/test/core_ext/object/json_cherry_pick_test.rb b/activesupport/test/core_ext/object/json_cherry_pick_test.rb index b11b25248e..fe93bf0355 100644 --- a/activesupport/test/core_ext/object/json_cherry_pick_test.rb +++ b/activesupport/test/core_ext/object/json_cherry_pick_test.rb @@ -2,7 +2,7 @@ require_relative "../../abstract_unit" -# These test cases were added to test that cherry-picking the json extensions +# These test cases were added to test that cherry-picking the JSON extensions # works correctly, primarily for dependencies problems reported in #16131. They # need to be executed in isolation to reproduce the scenario correctly, because # other test cases might have already loaded additional dependencies. diff --git a/activesupport/test/core_ext/object/json_gem_encoding_test.rb b/activesupport/test/core_ext/object/json_gem_encoding_test.rb index c80fac2ab1..ef2dc60036 100644 --- a/activesupport/test/core_ext/object/json_gem_encoding_test.rb +++ b/activesupport/test/core_ext/object/json_gem_encoding_test.rb @@ -4,7 +4,7 @@ require_relative "../../abstract_unit" require "json" require_relative "../../json/encoding_test_cases" -# These test cases were added to test that we do not interfere with json gem's +# These test cases were added to test that we do not interfere with JSON gem's # output when the AS encoder is loaded, primarily for problems reported in # #20775. They need to be executed in isolation to reproduce the scenario # correctly, because other test cases might have already loaded additional diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb index c6a6e76e45..439d1cb87d 100644 --- a/activesupport/test/json/decoding_test.rb +++ b/activesupport/test/json/decoding_test.rb @@ -66,9 +66,9 @@ class TestJSONDecoding < ActiveSupport::TestCase %q({"a":"\n"}) => { "a" => "\n" }, %q({"a":"\u000a"}) => { "a" => "\n" }, %q({"a":"Line1\u000aLine2"}) => { "a" => "Line1\nLine2" }, - # prevent json unmarshalling + # prevent JSON unmarshalling '{"json_class":"TestJSONDecoding::Foo"}' => { "json_class" => "TestJSONDecoding::Foo" }, - # json "fragments" - these are invalid JSON, but ActionPack relies on this + # JSON "fragments" - these are invalid JSON, but ActionPack relies on this '"a string"' => "a string", "1.1" => 1.1, "1" => 1, @@ -81,7 +81,7 @@ class TestJSONDecoding < ActiveSupport::TestCase TESTS.each_with_index do |(json, expected), index| fail_message = "JSON decoding failed for #{json}" - test "json decodes #{index}" do + test "JSON decodes #{index}" do with_tz_default "Eastern Time (US & Canada)" do with_parse_json_times(true) do silence_warnings do @@ -96,7 +96,7 @@ class TestJSONDecoding < ActiveSupport::TestCase end end - test "json decodes time json with time parsing disabled" do + test "JSON decodes time JSON with time parsing disabled" do with_parse_json_times(false) do expected = { "a" => "2007-01-01 01:12:34 Z" } assert_equal expected, ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34 Z"})) diff --git a/guides/source/4_1_release_notes.md b/guides/source/4_1_release_notes.md index 390df59ccf..f77d68edb2 100644 --- a/guides/source/4_1_release_notes.md +++ b/guides/source/4_1_release_notes.md @@ -496,7 +496,7 @@ for detailed changes. map to integers in the database, but can be queried by name. ([Commit](https://github.com/rails/rails/commit/db41eb8a6ea88b854bf5cd11070ea4245e1639c5)) -* Type cast json values on write, so that the value is consistent with reading +* Type cast JSON values on write, so that the value is consistent with reading from the database. ([Pull Request](https://github.com/rails/rails/pull/12643)) * Type cast hstore values on write, so that the value is consistent diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 1be71dab05..95dab83412 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -1191,7 +1191,7 @@ The I18n API described in this guide is primarily intended for translating inter Several gems can help with this: -* [Mobility](https://github.com/shioyama/mobility): Provides support for storing translations in many formats, including translation tables, json columns (PostgreSQL), etc. +* [Mobility](https://github.com/shioyama/mobility): Provides support for storing translations in many formats, including translation tables, JSON columns (PostgreSQL), etc. * [Traco](https://github.com/barsoom/traco): Translatable columns stored in the model table itself Conclusion diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index e83b69a093..0c5089c138 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -2245,7 +2245,7 @@ start using the more precise `:plain`, `:html`, and `:body` options instead. Using `render :text` may pose a security risk, as the content is sent as `text/html`. -### PostgreSQL json and hstore datatypes +### PostgreSQL JSON and hstore datatypes Rails 4.1 will map `json` and `hstore` columns to a string-keyed Ruby `Hash`. In earlier versions, a `HashWithIndifferentAccess` was used. This means that diff --git a/railties/test/application/middleware/cookies_test.rb b/railties/test/application/middleware/cookies_test.rb index 4b31b0f91a..90831ab916 100644 --- a/railties/test/application/middleware/cookies_test.rb +++ b/railties/test/application/middleware/cookies_test.rb @@ -121,7 +121,7 @@ module ApplicationTests assert_equal "signed cookie", verifier_sha512.verify(last_response.body, purpose: "cookie.signed_cookie") end - test "signed cookies with SHA512 digest and json serializer and rotated out SHA256 and SHA1 digests" do + test "signed cookies with SHA512 digest and JSON serializer and rotated out SHA256 and SHA1 digests" do app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do get ':controller(/:action)' diff --git a/railties/test/application/middleware/session_test.rb b/railties/test/application/middleware/session_test.rb index 2ba07ad5be..fb16dcdd15 100644 --- a/railties/test/application/middleware/session_test.rb +++ b/railties/test/application/middleware/session_test.rb @@ -136,7 +136,7 @@ module ApplicationTests assert_equal '"1"', last_response.body end - test "session using encrypted cookie store with json serializer" do + test "session using encrypted cookie store with JSON serializer" do app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do get ':controller(/:action)'