~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to test/other/dsl.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env ruby
2
2
 
3
 
$:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
 
3
require File.dirname(__FILE__) + '/../lib/puppettest'
4
4
 
5
5
require 'puppet'
6
6
require 'puppet/dsl'
7
 
require 'puppet/autoload'
8
7
require 'puppettest'
9
8
 
10
9
class TestDSL < Test::Unit::TestCase
12
11
        include Puppet::DSL
13
12
 
14
13
    def teardown
15
 
        Puppet::Aspect.clear
 
14
        super
 
15
        Puppet::DSL::Aspect.clear
16
16
    end
17
17
 
18
18
    def test_aspect
22
22
            end
23
23
        end
24
24
 
25
 
        assert_equal(a, Puppet::Aspect[:yaytest])
 
25
        assert_equal(a, Puppet::DSL::Aspect[:yaytest])
26
26
 
27
27
        # Now make a child aspect
28
28
        b = nil
154
154
 
155
155
        resource = nil
156
156
        assert_nothing_raised do
157
 
            resource = a.newresource filetype, path,
158
 
                :content => "yay", :mode => "640"
 
157
            resource = a.newresource filetype, path, :content => "yay", :mode => "640"
159
158
        end
160
159
 
161
160
        assert_instance_of(Puppet::Parser::Resource, resource)
193
192
    end
194
193
 
195
194
    def test_typemethods
 
195
        Puppet::Type.loadall
196
196
        filetype = Puppet::Type.type(:file)
197
197
        path = tempfile()
198
198
 
199
199
        a = aspect :testing
200
200
 
201
201
        Puppet::Type.eachtype do |type|
 
202
            next if type.name.to_s =~ /test/
202
203
            assert(a.respond_to?(type.name),
203
204
                "Aspects do not have a %s method" % type.name)
204
205
        end
212
213
        assert_instance_of(Puppet::Parser::Resource, file)
213
214
    end
214
215
end
215
 
 
216
 
# $Id: dsl.rb 1814 2006-10-18 19:16:25Z luke $