summaryrefslogtreecommitdiffstats
path: root/test/rails
diff options
context:
space:
mode:
authorshadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-15 20:26:40 +0000
committershadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-15 20:26:40 +0000
commit91991f186711251f20e1608815c49d360051c29a (patch)
tree0a0fab9db459b2d03f2dce89bcf15121d28a7b74 /test/rails
parent0b5600a6b49400551b01cec7aa3286d42e45d36c (diff)
downloadpuppet-91991f186711251f20e1608815c49d360051c29a.tar.gz
puppet-91991f186711251f20e1608815c49d360051c29a.tar.xz
puppet-91991f186711251f20e1608815c49d360051c29a.zip
Merge fact_names & fact_values, and param_names & param_values.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2191 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/rails')
-rwxr-xr-xtest/rails/host.rb28
-rwxr-xr-xtest/rails/railsparameter.rb8
-rwxr-xr-xtest/rails/railsresource.rb7
3 files changed, 18 insertions, 25 deletions
diff --git a/test/rails/host.rb b/test/rails/host.rb
index 184d536d5..e8b9a1603 100755
--- a/test/rails/host.rb
+++ b/test/rails/host.rb
@@ -153,20 +153,20 @@ class TestRailsHost < Test::Unit::TestCase
# This actually works in real life, but I can't get it to work in testing.
# I expect it's a caching problem.
-# count = 0
-# host.resources.find(:all).find_all { |r| r.title =~ /file2/ }.each do |r|
-# puts "%s => %s" % [r.ref, r.parameters.inspect]
-# assert_equal("notice", r.parameter("loglevel"),
-# "loglevel was not added")
-# case r.restype
-# when "file":
-# assert_equal("fake", r.parameter("owner"), "owner was not modified")
-# when "exec":
-# assert_equal("fake", r.parameter("user"), "user was not modified")
-# else
-# raise "invalid resource type %s" % r.restype
-# end
-# end
+ count = 0
+ host.resources.find(:all).find_all { |r| r.title =~ /file2/ }.each do |r|
+ puts "%s => %s" % [r.ref, r.parameters.inspect]
+ assert_equal("notice", r.parameter("loglevel"),
+ "loglevel was not added")
+ case r.restype
+ when "file":
+ assert_equal("fake", r.parameter("owner"), "owner was not modified")
+ when "exec":
+ assert_equal("fake", r.parameter("user"), "user was not modified")
+ else
+ raise "invalid resource type %s" % r.restype
+ end
+ end
end
else
$stderr.puts "Install Rails for Rails and Caching tests"
diff --git a/test/rails/railsparameter.rb b/test/rails/railsparameter.rb
index 337f4cb3c..2a306890b 100755
--- a/test/rails/railsparameter.rb
+++ b/test/rails/railsparameter.rb
@@ -25,18 +25,12 @@ class TestRailsParameter < Test::Unit::TestCase
# Use array and non-array values, to make sure we get things back in
# the same form.
{"myname" => "myval", "multiple" => %w{one two three}}.each do |name, value|
- param = Puppet::Rails::ParamName.new(:name => name)
+ param = Puppet::Rails::ParamName.new(:name => name, :value => value)
if value.is_a? Array
values = value
else
values = [value]
end
- valueobjects = values.collect do |v|
- obj = Puppet::Rails::ParamValue.new(:value => v)
- assert_nothing_raised do
- param.param_values << obj
- end
- end
assert(param, "Did not create rails parameter")
diff --git a/test/rails/railsresource.rb b/test/rails/railsresource.rb
index 302dd99fb..f3cdc22a6 100755
--- a/test/rails/railsresource.rb
+++ b/test/rails/railsresource.rb
@@ -36,9 +36,8 @@ class TestRailsResource < Test::Unit::TestCase
# Now add some params
params.each do |param, value|
- pn = resource.param_names.find_or_create_by_name(param)
- pv = pn.param_values.find_or_create_by_value(value)
- resource.param_names << pn
+ pn = resource.params.find_or_create_by_name_and_value(param, value)
+ resource.params << pn
end
host.save
@@ -58,7 +57,7 @@ class TestRailsResource < Test::Unit::TestCase
interp, scope, source = mkclassframing
# Find the new resource and include all it's parameters.
- resource = Puppet::Rails::Resource.find_by_id(resource.id, :include => [ :param_names, :param_values ])
+ resource = Puppet::Rails::Resource.find_by_id(resource.id, :include => [ :params ])
# Now, try to convert our resource to a real resource
res = nil