summaryrefslogtreecommitdiffstats
path: root/test/language/rails.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-13 20:01:12 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-13 20:01:12 +0000
commit637cc71296f96fd1d5f2ca83aa7e20c73757f8dd (patch)
treef3b055bf75d7df6cbabafb24334710071f2ef8ec /test/language/rails.rb
parent9e9ef1acc6231254e52b96257ed1e81475d2d1bc (diff)
downloadpuppet-637cc71296f96fd1d5f2ca83aa7e20c73757f8dd.tar.gz
puppet-637cc71296f96fd1d5f2ca83aa7e20c73757f8dd.tar.xz
puppet-637cc71296f96fd1d5f2ca83aa7e20c73757f8dd.zip
I appear to have object collection working, incredibly. This commit does the collection from the database up to adding the objects to the current scope, which is what sends it to the client.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1190 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language/rails.rb')
-rwxr-xr-xtest/language/rails.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/language/rails.rb b/test/language/rails.rb
index e85652620..13bee4c5b 100755
--- a/test/language/rails.rb
+++ b/test/language/rails.rb
@@ -62,7 +62,21 @@ class TestRails < Test::Unit::TestCase
assert(host.rails_objects, "No objects on host")
- collectable = host.rails_objects.find_all do |obj| obj.collectable end
+ assert_equal(facts["hostname"], host.facts["hostname"],
+ "Did not retrieve facts")
+
+ inline_test_objectcollection(host)
+ end
+
+ # This is called from another test, it just makes sense to split it out some
+ def inline_test_objectcollection(host)
+ # XXX For some reason, find_all doesn't work here at all.
+ collectable = []
+ host.rails_objects.each do |obj|
+ if obj.collectable?
+ collectable << obj
+ end
+ end
assert(collectable.length > 0, "Found no collectable objects")
@@ -76,8 +90,12 @@ class TestRails < Test::Unit::TestCase
assert(!trans.collectable, "Object from db was collectable")
end
- assert_equal(facts["hostname"], host.facts["hostname"],
- "Did not retrieve facts")
+ # Now find all collectable objects directly through database APIs
+
+ list = Puppet::Rails::RailsObject.find_all_by_collectable(true)
+
+ assert_equal(collectable.length, list.length,
+ "Did not get the right number of objects")
end
def test_railsinit