Skip to content

Commit 65e0b2a

Browse files
committed
Additional fixes for tests
1 parent 5954fc8 commit 65e0b2a

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

spec/integration/directory_environments_spec.rb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
require 'spec_helper'
2+
require 'puppet/application/config'
23

34
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] }
67

78
context "with a single directory environmentpath" do
89
before(:each) do
@@ -12,16 +13,18 @@
1213
end
1314

1415
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)
1618
expect {
1719
puppet.run
1820
}.to exit_with(0)
1921
.and output(%r{/direnv/modules}).to_stdout
2022
end
2123

2224
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)
2528
expect {
2629
puppet.run
2730
}.to exit_with(0)
@@ -38,7 +41,8 @@
3841
Puppet[:environmentpath] = shortened
3942
expect(Puppet[:environmentpath]).to match(/~/)
4043

41-
Puppet.settings.initialize_global_settings(args)
44+
puppet.command_line.args = args
45+
Puppet.initialize_settings(args)
4246
expect {
4347
puppet.run
4448
}.to exit_with(0)
@@ -47,7 +51,7 @@
4751
end
4852

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

5256
before(:each) do
5357
envdir1 = File.join(Puppet[:confdir], 'env1')
@@ -57,7 +61,8 @@
5761
end
5862

5963
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)
6166
expect {
6267
puppet.run
6368
}.to exit_with(0)

spec/unit/application/agent_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,6 @@ def run(options = {}); end
286286
end
287287
end
288288

289-
it "should print puppet config if asked to in Puppet config" do
290-
Puppet[:configprint] = "plugindest"
291-
expect(Puppet.settings).to receive(:print_configs).and_return(true)
292-
expect { execute_agent }.to exit_with 0
293-
end
294-
295-
it "should exit after printing puppet config if asked to in Puppet config" do
296-
path = make_absolute('/my/path')
297-
Puppet[:modulepath] = path
298-
Puppet[:configprint] = "modulepath"
299-
expect_any_instance_of(Puppet::Settings).to receive(:puts).with(path)
300-
expect { execute_agent }.to exit_with 0
301-
end
302289

303290
it "should use :main, :puppetd, and :ssl" do
304291
expect(Puppet.settings).to receive(:use).with(:main, :agent, :ssl)

0 commit comments

Comments
 (0)