Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

to_sentence should return a duplicate

  • Loading branch information...
commit dd55830bb279a4ef492727d6ffda169eb569ba27 1 parent c017041
Matthew Mongeau authored wycats committed
View
2  activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -26,7 +26,7 @@ def to_sentence(options = {})
when 0
""
when 1
- self[0].to_s
+ self[0].to_s.dup
when 2
"#{self[0]}#{options[:two_words_connector]}#{self[1]}"
else
View
5 activesupport/test/core_ext/array_ext_test.rb
@@ -82,6 +82,11 @@ def test_one_element
assert_equal "one", ['one'].to_sentence
end
+ def test_one_element_not_same_object
+ elements = ["one"]
+ assert_not_equal elements[0].object_id, elements.to_sentence.object_id
+ end
+
def test_one_non_string_element
assert_equal '1', [1].to_sentence
end
Please sign in to comment.
Something went wrong with that request. Please try again.