1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #39477 from p8/improve-inspect

Make custom inspect methods more consistent
This commit is contained in:
Aaron Patterson 2020-06-03 10:43:35 -07:00 committed by GitHub
commit 35fe9bc0aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View file

@ -855,7 +855,7 @@ module ActionController
end
def inspect
"<#{self.class} #{@parameters} permitted: #{@permitted}>"
"#<#{self.class} #{@parameters} permitted: #{@permitted}>"
end
def self.hook_into_yaml_loading # :nodoc:

View file

@ -369,7 +369,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
test "inspect shows both class name, parameters and permitted flag" do
assert_equal(
'<ActionController::Parameters {"person"=>{"age"=>"32", '\
'#<ActionController::Parameters {"person"=>{"age"=>"32", '\
'"name"=>{"first"=>"David", "last"=>"Heinemeier Hansson"}, ' \
'"addresses"=>[{"city"=>"Chicago", "state"=>"Illinois"}]}} permitted: false>',
@params.inspect

View file

@ -169,7 +169,7 @@ module ActiveModel
end
def inspect # :nodoc:
"<##{self.class.name} attribute=#{@attribute}, type=#{@type}, options=#{@options.inspect}>"
"#<#{self.class.name} attribute=#{@attribute}, type=#{@type}, options=#{@options.inspect}>"
end
protected

View file

@ -104,7 +104,7 @@ module ActiveSupport
end
def inspect # :nodoc:
"<##{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>"
"#<#{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>"
end
# Synchronize calls to the cache. This should be called wherever the underlying cache implementation

View file

@ -195,7 +195,7 @@ module ActiveSupport
def inspect
instance = @redis || @redis_options
"<##{self.class} options=#{options.inspect} redis=#{instance.inspect}>"
"#<#{self.class} options=#{options.inspect} redis=#{instance.inspect}>"
end
# Cache Store API implementation.

View file

@ -1319,7 +1319,7 @@ module ApplicationTests
app "development"
post "/posts.json", '{ "title": "foo", "name": "bar" }', "CONTENT_TYPE" => "application/json"
assert_equal '<ActionController::Parameters {"title"=>"foo"} permitted: false>', last_response.body
assert_equal '#<ActionController::Parameters {"title"=>"foo"} permitted: false>', last_response.body
end
test "config.action_controller.permit_all_parameters = true" do