Sha256: 484a15323264e5ed14111341c371b7a70684fc1cbd690b71533f53c0e95c892f

Contents?: true

Size: 1.69 KB

Versions: 51

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

describe "directory environments" do
  let(:args) { ['--configprint', 'modulepath', '--environment', 'direnv'] }
  let(:puppet) do
    app = Puppet::Application[:apply]
    app.stubs(:command_line).returns(stub('command_line', :args => []))
    app
  end

  context "with a single directory environmentpath" do
    before(:each) do
      environmentdir = PuppetSpec::Files.tmpdir('envpath')
      Puppet[:environmentpath] = environmentdir
      FileUtils.mkdir_p(environmentdir + "/direnv/modules")
    end

    it "config prints the environments modulepath" do
      Puppet.settings.initialize_global_settings(args)
      expect do
        expect { puppet.run }.to exit_with(0)
      end.to have_printed('direnv/modules')
    end

    it "config prints the cli --modulepath despite environment" do
      args << '--modulepath' << 'completely/different'
      Puppet.settings.initialize_global_settings(args)
      expect do
        expect { puppet.run }.to exit_with(0)
      end.to have_printed('completely/different')
    end
  end

  context "with an environmentpath having multiple directories" do
    let(:args) { ['--configprint', 'modulepath', '--environment', 'otherdirenv'] }

    before(:each) do
      envdir1 = File.join(Puppet[:confdir], 'env1')
      envdir2 = File.join(Puppet[:confdir], 'env2')
      Puppet[:environmentpath] = [envdir1, envdir2].join(File::PATH_SEPARATOR)
      FileUtils.mkdir_p(envdir2 + "/otherdirenv/modules")
    end

    it "config prints a directory environment modulepath" do
      Puppet.settings.initialize_global_settings(args)
      expect do
        expect { puppet.run }.to exit_with(0)
      end.to have_printed('otherdirenv/modules')
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

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