~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to test/lib/puppettest/railstesting.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2011-10-22 14:08:22 UTC
  • mfrom: (1.1.25) (3.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20111022140822-odxde5lohc45yhuz
Tags: 2.7.6-1
* New upstream release (CVE-2011-3872)
* Remove cherry-picked "groupadd_aix_warning" patch
* Install all new manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
  def railsinit
15
15
    Puppet::Rails.init
16
16
  end
17
 
 
18
 
  def railsteardown
19
 
    Puppet::Rails.teardown if Puppet[:dbadapter] != "sqlite3"
20
 
  end
21
 
 
22
 
  def railsresource(type = "file", title = "/tmp/testing", params = {})
23
 
    railsteardown
24
 
    railsinit
25
 
 
26
 
    # We need a host for resources
27
 
    #host = Puppet::Rails::Host.new(:name => Facter.value("hostname"))
28
 
 
29
 
    # Now build a resource
30
 
    resources = []
31
 
 
32
 
      resources << mkresource(
33
 
        :type => type, :title => title, :exported => true,
34
 
 
35
 
          :parameters => params)
36
 
 
37
 
    # Now collect our facts
38
 
    facts = Facter.to_hash
39
 
 
40
 
    # Now try storing our crap
41
 
    host = nil
42
 
    node = mknode(facts["hostname"])
43
 
    node.parameters = facts
44
 
    assert_nothing_raised {
45
 
      host = Puppet::Rails::Host.store(node, resources)
46
 
    }
47
 
 
48
 
    # Now save the whole thing
49
 
    host.save
50
 
  end
51
17
end
52
18