summaryrefslogtreecommitdiffstats
path: root/test/rails/railsresource.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-18 19:47:09 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-18 19:47:09 +0000
commitf59ce4ee06ac734362a8fced4523b657ed4adef3 (patch)
tree23258bbc0046d78452d32a6ab7d69e3710edbd5c /test/rails/railsresource.rb
parent53a469c0000eb1f487eab456c0986d427d714bd7 (diff)
downloadpuppet-f59ce4ee06ac734362a8fced4523b657ed4adef3.tar.gz
puppet-f59ce4ee06ac734362a8fced4523b657ed4adef3.tar.xz
puppet-f59ce4ee06ac734362a8fced4523b657ed4adef3.zip
Fixing #695 -- resource references will correctly serialize and unserialize in the db
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2706 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/rails/railsresource.rb')
-rwxr-xr-xtest/rails/railsresource.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/rails/railsresource.rb b/test/rails/railsresource.rb
index 32408db21..b8e5450b3 100755
--- a/test/rails/railsresource.rb
+++ b/test/rails/railsresource.rb
@@ -184,6 +184,8 @@ class TestExportedResources < PuppetTest::TestCase
"%s was different %s" % [param.name, tail])
end
end
+
+ return obj
end
def test_to_rails
@@ -201,13 +203,20 @@ class TestExportedResources < PuppetTest::TestCase
# We also need a Rails Host to store under
host = Puppet::Rails::Host.new(:name => Facter.hostname)
- compare_resources(host, res, false, :params => %w{owner source mode})
+ railsres = compare_resources(host, res, false, :params => %w{owner source mode})
# Now make sure our parameters did not change
assert_instance_of(Array, res[:require], "Parameter array changed")
res[:require].each do |ref|
assert_instance_of(Reference, ref, "Resource reference changed")
end
+ assert_instance_of(Reference, res[:subscribe], "Resource reference changed")
+
+ # And make sure that the rails resource actually has resource references
+ params = railsres.parameters
+ [params["subscribe"], params["require"]].flatten.each do |ref|
+ assert_instance_of(Reference, ref, "Resource reference is no longer a reference")
+ end
# Now make some changes to our resource. We're removing the mode,
# changing the source, and adding 'check'.
@@ -219,13 +228,20 @@ class TestExportedResources < PuppetTest::TestCase
res.line = 75
res.exported = true
- compare_resources(host, res, true, :params => %w{owner source mode check})
+ railsres = compare_resources(host, res, true, :params => %w{owner source mode check})
# Again make sure our parameters did not change
assert_instance_of(Array, res[:require], "Parameter array changed")
res[:require].each do |ref|
assert_instance_of(Reference, ref, "Resource reference changed")
end
+
+ # Again with the serialization checks
+ params = railsres.parameters
+ [params["subscribe"], params["require"]].flatten.each do |ref|
+ assert_instance_of(Reference, ref, "Resource reference is no longer a reference")
+ end
+
end
end