aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-06-23 10:05:30 -0400
committerJosé Valim <jose.valim@gmail.com>2010-06-23 18:00:25 +0200
commiteb04408a20628a49296e0859425940b39a83ec63 (patch)
treee4d9aaeebb612b9a41fc5873a78c318e27d2eaf3 /activerecord/test/cases/relations_test.rb
parenta3ce6fcc567836c99bb93cbe880b2c333a511593 (diff)
downloadrails-eb04408a20628a49296e0859425940b39a83ec63.tar.gz
rails-eb04408a20628a49296e0859425940b39a83ec63.tar.bz2
rails-eb04408a20628a49296e0859425940b39a83ec63.zip
ActiveRecord's relation object should respond to to_json and to_yaml
[#4547 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r--activerecord/test/cases/relations_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 165b2e1e6c..f2216a1923 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -29,6 +29,16 @@ class RelationTest < ActiveRecord::TestCase
assert_equal 4, topics.size
end
+ def test_to_json
+ assert_nothing_raised { Bird.scoped.to_json }
+ assert_nothing_raised { Bird.scoped.all.to_json }
+ end
+
+ def test_to_yaml
+ assert_nothing_raised { Bird.scoped.to_yaml }
+ assert_nothing_raised { Bird.scoped.all.to_yaml }
+ end
+
def test_scoped_all
topics = Topic.scoped.all
assert_kind_of Array, topics