aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-05-31 23:25:36 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-05-31 23:25:36 +0000
commit408fe5facc482f84194bbe79865a26b57b2cc883 (patch)
tree52164d53e521712f51e99238af349de0885f9985 /activesupport/test/core_ext
parentd31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e (diff)
downloadrails-408fe5facc482f84194bbe79865a26b57b2cc883.tar.gz
rails-408fe5facc482f84194bbe79865a26b57b2cc883.tar.bz2
rails-408fe5facc482f84194bbe79865a26b57b2cc883.zip
Added Array#to_s(:db) that'll produce a comma-separated list of ids [DHH] Split Grouping into its own file
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4387 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb
index 0d5f58a9be..4cef0120d6 100644
--- a/activesupport/test/core_ext/array_ext_test.rb
+++ b/activesupport/test/core_ext/array_ext_test.rb
@@ -13,7 +13,7 @@ class ArrayExtToParamTests < Test::Unit::TestCase
end
end
-class ArrayExtConversionTests < Test::Unit::TestCase
+class ArrayExtToSentenceTests < Test::Unit::TestCase
def test_plain_array_to_sentence
assert_equal "", [].to_sentence
assert_equal "one", ['one'].to_sentence
@@ -39,6 +39,19 @@ class ArrayExtConversionTests < Test::Unit::TestCase
end
end
+class ArrayExtToSTests < Test::Unit::TestCase
+ def test_to_s_db
+ collection = [
+ Class.new { def id() 1 end }.new,
+ Class.new { def id() 2 end }.new,
+ Class.new { def id() 3 end }.new
+ ]
+
+ assert_equal "null", [].to_s(:db)
+ assert_equal "1,2,3", collection.to_s(:db)
+ end
+end
+
class ArrayExtGroupingTests < Test::Unit::TestCase
def test_group_by_with_perfect_fit
groups = []