diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 18:24:24 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 18:24:24 +0000 |
| commit | 28cee40689440388994a4768bd301ae32c8ecc05 (patch) | |
| tree | c865ab44f4c9247052cf83de16ffc8ebe8b15e54 /test/lib/puppettest/railstesting.rb | |
| parent | e0e291332bd4676962a28c7b220ae5c5e9651c0a (diff) | |
| download | puppet-28cee40689440388994a4768bd301ae32c8ecc05.tar.gz puppet-28cee40689440388994a4768bd301ae32c8ecc05.tar.xz puppet-28cee40689440388994a4768bd301ae32c8ecc05.zip | |
Merging the changes from the override-refactor branch. This is a significant rewrite of the parser, but it has little affect on the rest of the code tree.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1726 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/lib/puppettest/railstesting.rb')
| -rw-r--r-- | test/lib/puppettest/railstesting.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lib/puppettest/railstesting.rb b/test/lib/puppettest/railstesting.rb new file mode 100644 index 000000000..3a32d0c9e --- /dev/null +++ b/test/lib/puppettest/railstesting.rb @@ -0,0 +1,34 @@ +module PuppetTest::RailsTesting + Parser = Puppet::Parser + AST = Puppet::Parser::AST + include PuppetTest::ParserTesting + + def railsinit + Puppet::Rails.init + end + + def railsresource(type = "file", title = "/tmp/testing", params = {}) + railsinit + + # We need a host for resources + host = Puppet::Rails::Host.new(:name => Facter.value("hostname")) + + # Now build a resource + resource = host.rails_resources.build( + :title => title, :restype => type, + :exported => true + ) + + # Now add some params + params.each do |param, value| + resource.rails_parameters.build( + :name => param, :value => value + ) + end + + # Now save the whole thing + host.save + end +end + +# $Id$ |
