~nvalcarcel/ubuntu/lucid/puppet/fix-546677

« back to all changes in this revision

Viewing changes to spec/shared_behaviours/file_server_terminus.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:
7
7
    # This only works if the shared behaviour is included before
8
8
    # the 'before' block in the including context.
9
9
    before do
10
 
        Puppet::FileServing::Configuration.clear_cache
 
10
        Puppet::Util::Cacher.expire
 
11
        FileTest.stubs(:exists?).returns true
11
12
        FileTest.stubs(:exists?).with(Puppet[:fileserverconfig]).returns(true)
12
 
        FileTest.stubs(:exists?).with("/my/mount/path").returns(true)
13
 
        FileTest.stubs(:directory?).with("/my/mount/path").returns(true)
14
 
        FileTest.stubs(:readable?).with("/my/mount/path").returns(true)
 
13
 
 
14
        @path = Tempfile.new("file_server_testing")
 
15
        path = @path.path
 
16
        @path.close!
 
17
        @path = path
 
18
 
 
19
        Dir.mkdir(@path)
 
20
        File.open(File.join(@path, "myfile"), "w") { |f| f.print "my content" }
15
21
 
16
22
        # Use a real mount, so the integration is a bit deeper.
17
 
        @mount1 = Puppet::FileServing::Configuration::Mount.new("one")
18
 
        @mount1.path = "/my/mount/path"
 
23
        @mount1 = Puppet::FileServing::Configuration::Mount::File.new("one")
 
24
        @mount1.path = @path
19
25
 
20
26
        @parser = stub 'parser', :changed? => false
21
27
        @parser.stubs(:parse).returns("one" => @mount1)
25
31
        # Stub out the modules terminus
26
32
        @modules = mock 'modules terminus'
27
33
 
28
 
        @request = Puppet::Indirector::Request.new(:indirection, :method, "puppetmounts://myhost/one/my/file")
 
34
        @request = Puppet::Indirector::Request.new(:indirection, :method, "puppet://myhost/one/myfile")
29
35
    end
30
36
 
31
37
    it "should use the file server configuration to find files" do
32
38
        @modules.stubs(:find).returns(nil)
33
39
        @terminus.indirection.stubs(:terminus).with(:modules).returns(@modules)
34
40
 
35
 
        path = "/my/mount/path/my/file"
36
 
        FileTest.stubs(:exists?).with(path).returns(true)
37
 
        FileTest.stubs(:exists?).with("/my/mount/path").returns(true)
38
 
        @mount1.expects(:file).with("my/file", :node => nil).returns(path)
 
41
        path = File.join(@path, "myfile")
39
42
 
40
43
        @terminus.find(@request).should be_instance_of(@test_class)
41
44
    end