summaryrefslogtreecommitdiffstats
path: root/test/rails/railsresource.rb
diff options
context:
space:
mode:
authorballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-12 00:31:16 +0000
committerballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-12 00:31:16 +0000
commit68e37a99d5357f022662f9ba7cc564c48aed21a9 (patch)
treee8d94cc9ea44d312e8b96f94c887b88fc1b04e0f /test/rails/railsresource.rb
parentc26f678178d173bd7360362b2959af51c4d39762 (diff)
downloadpuppet-68e37a99d5357f022662f9ba7cc564c48aed21a9.tar.gz
puppet-68e37a99d5357f022662f9ba7cc564c48aed21a9.tar.xz
puppet-68e37a99d5357f022662f9ba7cc564c48aed21a9.zip
Major rework of the rails feature. Changed the relationship between
host and facts (now many-to-many with fact_name through fact_values). Also changed the relationship between resource and params (similarly many-to-many with param_names through param_values). Added the resource_tags and puppet_tags. The latter has the tag names and the former is the man-to-many link with resources. There is a little clean up left but the schema is in order. Also a test for the tags stuff is required. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2565 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/rails/railsresource.rb')
-rwxr-xr-xtest/rails/railsresource.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/rails/railsresource.rb b/test/rails/railsresource.rb
index 302dd99fb..236c43594 100755
--- a/test/rails/railsresource.rb
+++ b/test/rails/railsresource.rb
@@ -36,9 +36,9 @@ 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 = Puppet::Rails::ParamName.find_or_create_by_name(param)
+ pv = resource.param_values.create(:value => value,
+ :param_name => pn)
end
host.save
@@ -58,7 +58,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)
# Now, try to convert our resource to a real resource
res = nil
@@ -74,10 +74,12 @@ class TestRailsResource < Test::Unit::TestCase
def test_parameters
resource = mktest_resource
-
setparams = nil
assert_nothing_raised do
- setparams = resource.parameters
+ setparams = resource.parameters.inject({}) { |h, a|
+ h[a[0]] = a[1][0]
+ h
+ }
end
assert_equal(params, setparams,
"Did not get the right answer from #parameters")