Permalink
Browse files

to_sentence should return a duplicate

  • Loading branch information...
1 parent 82a58ab commit 92f4cca4a33344b80a17eac63f377fdc61107364 Matthew Mongeau committed with wycats Aug 17, 2010
@@ -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
@@ -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

0 comments on commit 92f4cca

Please sign in to comment.