Sha256: a0e3c556a55f28413e93ded7eab1f62705abfb12688603be2568f9b5753bc737

Contents?: true

Size: 1.42 KB

Versions: 57

Compression:

Stored size: 1.42 KB

Contents

#! /usr/bin/env ruby
shared_examples_for "Puppet::Indirector::FileServerTerminus" do
  # This only works if the shared behaviour is included before
  # the 'before' block in the including context.
  before do
    Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil)
    Puppet::FileSystem.stubs(:exist?).returns true
    Puppet::FileSystem.stubs(:exist?).with(Puppet[:fileserverconfig]).returns(true)

    @path = Tempfile.new("file_server_testing")
    path = @path.path
    @path.close!
    @path = path

    Dir.mkdir(@path)
    File.open(File.join(@path, "myfile"), "w") { |f| f.print "my content" }

    # Use a real mount, so the integration is a bit deeper.
    @mount1 = Puppet::FileServing::Configuration::Mount::File.new("one")
    @mount1.path = @path

    @parser = stub 'parser', :changed? => false
    @parser.stubs(:parse).returns("one" => @mount1)

    Puppet::FileServing::Configuration::Parser.stubs(:new).returns(@parser)

    # Stub out the modules terminus
    @modules = mock 'modules terminus'

    @request = Puppet::Indirector::Request.new(:indirection, :method, "puppet://myhost/one/myfile", nil)
  end

  it "should use the file server configuration to find files" do
    @modules.stubs(:find).returns(nil)
    @terminus.indirection.stubs(:terminus).with(:modules).returns(@modules)

    path = File.join(@path, "myfile")

    @terminus.find(@request).should be_instance_of(@test_class)
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.7-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.7-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.6 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.6-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.6-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.5 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.5-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.5-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.4 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.4-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.4-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.3 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.3-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.3-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.2 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.2-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.2-x64-mingw32 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.1 spec/shared_behaviours/file_server_terminus.rb
puppet-3.8.1-x86-mingw32 spec/shared_behaviours/file_server_terminus.rb