|
1 | 1 | require 'spec_helper' |
| 2 | +require 'puppet/application/config' |
2 | 3 |
|
3 | 4 | describe "directory environments" do |
4 | | - let(:args) { ['--configprint', 'modulepath', '--environment', 'direnv'] } |
5 | | - let(:puppet) { Puppet::Application[:apply] } |
| 5 | + let(:args) { ['print', 'modulepath', '--environment', 'direnv'] } |
| 6 | + let(:puppet) { Puppet::Application[:config] } |
6 | 7 |
|
7 | 8 | context "with a single directory environmentpath" do |
8 | 9 | before(:each) do |
|
12 | 13 | end |
13 | 14 |
|
14 | 15 | it "config prints the environments modulepath" do |
15 | | - Puppet.settings.initialize_global_settings(args) |
| 16 | + puppet.command_line.args = args |
| 17 | + Puppet.initialize_settings(args) |
16 | 18 | expect { |
17 | 19 | puppet.run |
18 | 20 | }.to exit_with(0) |
19 | 21 | .and output(%r{/direnv/modules}).to_stdout |
20 | 22 | end |
21 | 23 |
|
22 | 24 | it "config prints the cli --modulepath despite environment" do |
23 | | - args << '--modulepath' << '/completely/different' |
24 | | - Puppet.settings.initialize_global_settings(args) |
| 25 | + args.push('--modulepath', '/completely/different') |
| 26 | + puppet.command_line.args = args |
| 27 | + Puppet.initialize_settings(args) |
25 | 28 | expect { |
26 | 29 | puppet.run |
27 | 30 | }.to exit_with(0) |
|
38 | 41 | Puppet[:environmentpath] = shortened |
39 | 42 | expect(Puppet[:environmentpath]).to match(/~/) |
40 | 43 |
|
41 | | - Puppet.settings.initialize_global_settings(args) |
| 44 | + puppet.command_line.args = args |
| 45 | + Puppet.initialize_settings(args) |
42 | 46 | expect { |
43 | 47 | puppet.run |
44 | 48 | }.to exit_with(0) |
|
47 | 51 | end |
48 | 52 |
|
49 | 53 | context "with an environmentpath having multiple directories" do |
50 | | - let(:args) { ['--configprint', 'modulepath', '--environment', 'otherdirenv'] } |
| 54 | + let(:args) { ['print', 'modulepath', '--environment', 'otherdirenv'] } |
51 | 55 |
|
52 | 56 | before(:each) do |
53 | 57 | envdir1 = File.join(Puppet[:confdir], 'env1') |
|
57 | 61 | end |
58 | 62 |
|
59 | 63 | it "config prints a directory environment modulepath" do |
60 | | - Puppet.settings.initialize_global_settings(args) |
| 64 | + puppet.command_line.args = args |
| 65 | + Puppet.initialize_settings(args) |
61 | 66 | expect { |
62 | 67 | puppet.run |
63 | 68 | }.to exit_with(0) |
|
0 commit comments