~ubuntu-branches/ubuntu/lucid/puppet/lucid-security

« back to all changes in this revision

Viewing changes to spec/unit/parser/ast/resource_reference.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-12-23 00:48:10 UTC
  • mfrom: (1.1.10 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091223004810-3i4oryds922g5n59
Tags: 0.25.1-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/rules:
    + Don't start puppet when first installing puppet.
  - debian/puppet.conf, lib/puppet/defaults.rb:
    + Move templates to /etc/puppet
  - lib/puppet/defaults.rb:
    + Fix /var/lib/puppet/state ownership.
  - man/man8/puppet.conf.8: 
    + Fix broken URL in manpage.
  - debian/control:
    + Update maintainer accordint to spec.
    + Puppetmaster Recommends -> Suggests
    + Created puppet-testsuite as a seperate. Allow the users to run puppet's 
      testsuite.
  - tests/Rakefile: Fix rakefile so that the testsuite can acutally be ran.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    %{ "one::two" "one-two"}.each do |type|
23
23
        it "should evaluate correctly reference to define" do
24
24
            klass = stub 'klass', :title => "three", :classname => type
25
 
            @scope.stubs(:finddefine).returns(klass)
 
25
            @scope.stubs(:find_definition).returns(klass)
26
26
        
27
27
            newref("three", type).evaluate(@scope).to_ref.should == Puppet::Parser::Resource::Reference.new( :type => type, :title => "three" ).to_ref
28
28
        end
30
30
 
31
31
    it "should be able to call qualified_class" do
32
32
        klass = stub 'klass', :title => "three", :classname => "one"
33
 
        @scope.expects(:findclass).with("one").returns(klass)
 
33
        @scope.expects(:find_hostclass).with("one").returns(klass)
34
34
        newref("three","class").qualified_class(@scope,"one").should == "one" 
35
35
    end
36
36
 
37
37
    it "should be able to find qualified classes when evaluating" do
38
38
        klass = stub 'klass', :title => "one", :classname => "one"
39
 
        @scope.stubs(:findclass).returns(klass)
 
39
        @scope.stubs(:find_hostclass).returns(klass)
40
40
        
41
41
        evaled = newref("one", "class").evaluate(@scope)
42
42
        evaled.type.should == "Class"
47
47
        titles = mock 'titles', :safeevaluate => ["title1","title2"]
48
48
        ref = ast::ResourceReference.new( :title => titles, :type => "Resource" )
49
49
        ref.stubs(:qualified_type).with(@scope).returns("Resource")
50
 
        
 
50
 
51
51
        ref.evaluate(@scope).should have(2).elements
52
52
    end
53
53
 
56
56
        ref = ast::ResourceReference.new( :title => titles, :type => "Class" )
57
57
        ref.expects(:qualified_class).with(@scope,"title1").returns("class")
58
58
        ref.expects(:qualified_class).with(@scope,"title2").returns("class")
59
 
        
 
59
 
60
60
        ref.evaluate(@scope)
61
61
    end
62
62
 
 
63
    it "should return a correct representation when converting to string" do
 
64
        type = stub 'type', :is_a? => true, :to_s => "file"
 
65
        title = stub 'title', :is_a? => true, :to_s => "[/tmp/a, /tmp/b]"
 
66
 
 
67
        ast::ResourceReference.new( :type => type, :title => title ).to_s.should == "File[/tmp/a, /tmp/b]"
 
68
    end
63
69
end