summaryrefslogtreecommitdiffstats
path: root/test/rails/railsparameter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rails/railsparameter.rb')
-rwxr-xr-xtest/rails/railsparameter.rb92
1 files changed, 46 insertions, 46 deletions
diff --git a/test/rails/railsparameter.rb b/test/rails/railsparameter.rb
index ca7d207ba..9f6fc1c1e 100755
--- a/test/rails/railsparameter.rb
+++ b/test/rails/railsparameter.rb
@@ -10,71 +10,71 @@ require 'puppettest/railstesting'
# Don't do any tests w/out this class
if defined? ::ActiveRecord::Base
class TestRailsParameter < Test::Unit::TestCase
- include PuppetTest::RailsTesting
+ include PuppetTest::RailsTesting
- def params
- {"myname" => "myval", "multiple" => %w{one two three}}
- end
+ def params
+ {"myname" => "myval", "multiple" => %w{one two three}}
+ end
- # Create a resource param from a rails parameter
- def test_to_resourceparam
- railsinit
+ # Create a resource param from a rails parameter
+ def test_to_resourceparam
+ railsinit
- # Now create a source
- parser = mkparser
- source = parser.newclass "myclass"
+ # Now create a source
+ parser = mkparser
+ source = parser.newclass "myclass"
- host = Puppet::Rails::Host.new(:name => "myhost")
+ host = Puppet::Rails::Host.new(:name => "myhost")
- host.save
+ host.save
- resource = host.resources.create(
+ resource = host.resources.create(
- :title => "/tmp/to_resource",
- :restype => "file",
+ :title => "/tmp/to_resource",
+ :restype => "file",
- :exported => true)
+ :exported => true)
- # Use array and non-array values, to make sure we get things back in
- # the same form.
- params.each do |name, value|
- param = Puppet::Rails::ParamName.find_or_create_by_name(name)
- if value.is_a? Array
- values = value
- else
- values = [value]
- end
- valueobjects = values.collect do |v|
+ # Use array and non-array values, to make sure we get things back in
+ # the same form.
+ params.each do |name, value|
+ param = Puppet::Rails::ParamName.find_or_create_by_name(name)
+ if value.is_a? Array
+ values = value
+ else
+ values = [value]
+ end
+ valueobjects = values.collect do |v|
- resource.param_values.create(
- :value => v,
+ resource.param_values.create(
+ :value => v,
- :param_name => param)
- end
+ :param_name => param)
+ end
- assert(param, "Did not create rails parameter")
+ assert(param, "Did not create rails parameter")
- # The id doesn't get assigned until we save
- end
+ # The id doesn't get assigned until we save
+ end
- resource.save
+ resource.save
- # And try to convert our parameter
- params.each do |name, value|
- param = Puppet::Rails::ParamName.find_by_name(name)
- pp = nil
- assert_nothing_raised do
- pp = param.to_resourceparam(resource, source)
- end
+ # And try to convert our parameter
+ params.each do |name, value|
+ param = Puppet::Rails::ParamName.find_by_name(name)
+ pp = nil
+ assert_nothing_raised do
+ pp = param.to_resourceparam(resource, source)
+ end
- assert_instance_of(Puppet::Parser::Resource::Param, pp)
- assert_equal(name.to_sym, pp.name, "parameter name was not equal")
- assert_equal(value, pp.value, "value was not equal for #{value.inspect}")
- end
+ assert_instance_of(Puppet::Parser::Resource::Param, pp)
+ assert_equal(name.to_sym, pp.name, "parameter name was not equal")
+ assert_equal(value, pp.value, "value was not equal for #{value.inspect}")
end
+ end
end
else
- $stderr.puts "Install Rails for Rails and Caching tests"
+ $stderr.puts "Install Rails for Rails and Caching tests"
end