Sha256: c38a00fb46e5d2459c3a5eb71f69cd55cd40c136bcab6c373862c746a064d886

Contents?: true

Size: 1.54 KB

Versions: 44

Compression:

Stored size: 1.54 KB

Contents

#! /usr/bin/env ruby

shared_examples_for "a file_serving model" do
  include PuppetSpec::Files

  describe "#indirection" do
    localpath = PuppetSpec::Files.make_absolute("/etc/sudoers")
    localurl = "file://" + localpath

    before :each do
      # Never connect to the network, no matter what
      described_class.indirection.terminus(:rest).class.any_instance.stubs(:find)
    end

    describe "when running the apply application" do
      before :each do
        Puppet[:default_file_terminus] = 'file_server'
      end

      {
       localpath => :file,
       localurl => :file,
       "puppet:///modules/foo/bar"       => :file_server,
       "puppet://server/modules/foo/bar" => :rest,
      }.each do |key, terminus|
        it "should use the #{terminus} terminus when requesting #{key.inspect}" do
          described_class.indirection.terminus(terminus).class.any_instance.expects(:find)

          described_class.indirection.find(key)
        end
      end
    end

    describe "when running another application" do
      before :each do
        Puppet[:default_file_terminus] = 'rest'
      end

      {
       localpath => :file,
       localurl => :file,
       "puppet:///modules/foo/bar"       => :rest,
       "puppet://server/modules/foo/bar" => :rest,
      }.each do |key, terminus|
        it "should use the #{terminus} terminus when requesting #{key.inspect}" do
          described_class.indirection.terminus(terminus).class.any_instance.expects(:find)

          described_class.indirection.find(key)
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/shared_behaviours/file_serving_model.rb
puppet-6.4.0-x86-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.4.0-x64-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.4.0-universal-darwin spec/shared_behaviours/file_serving_model.rb
puppet-6.0.7 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.7-x86-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.7-x64-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.7-universal-darwin spec/shared_behaviours/file_serving_model.rb
puppet-6.3.0 spec/shared_behaviours/file_serving_model.rb
puppet-6.3.0-x86-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.3.0-x64-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.3.0-universal-darwin spec/shared_behaviours/file_serving_model.rb
puppet-6.2.0 spec/shared_behaviours/file_serving_model.rb
puppet-6.2.0-x86-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.2.0-x64-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.2.0-universal-darwin spec/shared_behaviours/file_serving_model.rb
puppet-6.0.5 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.5-x86-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.5-x64-mingw32 spec/shared_behaviours/file_serving_model.rb
puppet-6.0.5-universal-darwin spec/shared_behaviours/file_serving_model.rb