mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix OrderedHash#inspect recursion
This commit is contained in:
@@ -93,7 +93,7 @@ module ActiveSupport
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<OrderedHash #{self.to_hash.inspect}>"
|
||||
"#<OrderedHash #{super}>"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -4,9 +4,11 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@keys = %w( blue green red pink orange )
|
||||
@values = %w( 000099 009900 aa0000 cc0066 cc6633 )
|
||||
@hash = Hash.new
|
||||
@ordered_hash = ActiveSupport::OrderedHash.new
|
||||
|
||||
@keys.each_with_index do |key, index|
|
||||
@hash[key] = @values[index]
|
||||
@ordered_hash[key] = @values[index]
|
||||
end
|
||||
end
|
||||
@@ -17,7 +19,7 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_access
|
||||
assert @keys.zip(@values).all? { |k, v| @ordered_hash[k] == v }
|
||||
assert @hash.all? { |k, v| @ordered_hash[k] == v }
|
||||
end
|
||||
|
||||
def test_assignment
|
||||
@@ -152,4 +154,8 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||
@ordered_hash.keys.pop
|
||||
assert_equal original, @ordered_hash.keys
|
||||
end
|
||||
|
||||
def test_inspect
|
||||
assert @ordered_hash.inspect.include?(@hash.inspect)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user