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

« back to all changes in this revision

Viewing changes to spec/unit/indirector/file_metadata/modules.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:
1
 
#!/usr/bin/env ruby
2
 
#
3
 
#  Created by Luke Kanies on 2007-10-18.
4
 
#  Copyright (c) 2007. All rights reserved.
5
 
 
6
 
require File.dirname(__FILE__) + '/../../../spec_helper'
7
 
 
8
 
require 'puppet/indirector/file_metadata/modules'
9
 
 
10
 
describe Puppet::Indirector::FileMetadata::Modules do
11
 
    it "should be registered with the file_metadata indirection" do
12
 
        Puppet::Indirector::Terminus.terminus_class(:file_metadata, :modules).should equal(Puppet::Indirector::FileMetadata::Modules)
13
 
    end
14
 
 
15
 
    it "should be a subclass of the ModuleFiles terminus" do
16
 
        Puppet::Indirector::FileMetadata::Modules.superclass.should equal(Puppet::Indirector::ModuleFiles)
17
 
    end
18
 
end
19
 
 
20
 
describe Puppet::Indirector::FileMetadata::Modules, " when finding metadata" do
21
 
    before do
22
 
        @finder = Puppet::Indirector::FileMetadata::Modules.new
23
 
        @finder.stubs(:environment).returns(nil)
24
 
        @module = Puppet::Module.new("mymod", "/path/to")
25
 
        @finder.stubs(:find_module).returns(@module)
26
 
 
27
 
        @request = Puppet::Indirector::Request.new(:metadata, :find, "puppetmounts://hostname/modules/mymod/my/file")
28
 
    end
29
 
 
30
 
    it "should return nil if the file is not found" do
31
 
        FileTest.expects(:exists?).with("/path/to/files/my/file").returns false
32
 
        @finder.find(@request).should be_nil
33
 
    end
34
 
 
35
 
    it "should retrieve the instance's attributes if the file is found" do
36
 
        FileTest.expects(:exists?).with("/path/to/files/my/file").returns true
37
 
        instance = mock 'metadta'
38
 
        Puppet::FileServing::Metadata.expects(:new).returns instance
39
 
        instance.expects :collect_attributes
40
 
        @finder.find(@request)
41
 
    end
42
 
end