Skip to content

Commit e284592

Browse files
committed
(PUP-4435) Remove unneeded expectations
Removes the `chuser` expectations when testing for deprecation notice as that is tested in the `user privileges` context, and refactors stubbing `:rack` options to the before each hook.
1 parent e984e0c commit e284592

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

spec/unit/application/master_spec.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,6 @@ def a_user_type_for(username)
339339
end
340340

341341
it "should log a deprecation notice when running a WEBrick server" do
342-
Puppet.features.stubs(:root?).returns true
343-
a_user_type_for("puppet").expects(:exists?).returns true
344-
Puppet::Util.expects(:chuser)
345-
346342
Puppet.expects(:deprecation_warning).with("The WEBrick Puppet master server is deprecated and will be removed in a future release. Please use Puppet Server instead. See http://links.puppetlabs.com/deprecate-rack-webrick-servers for more information.")
347343

348344
@master.main
@@ -366,29 +362,22 @@ def a_user_type_for(username)
366362
before do
367363
require 'puppet/network/http/rack'
368364
Puppet::Network::HTTP::Rack.stubs(:new).returns(@app)
369-
end
370365

371-
it "it should not start a daemon" do
372366
@master.options.stubs(:[]).with(:rack).returns(:true)
367+
end
373368

369+
it "it should not start a daemon" do
374370
@daemon.expects(:start).never
375371

376372
@master.main
377373
end
378374

379375
it "it should return the app" do
380-
@master.options.stubs(:[]).with(:rack).returns(:true)
381-
382376
app = @master.main
383377
expect(app).to equal(@app)
384378
end
385379

386380
it "should log a deprecation notice" do
387-
@master.options.stubs(:[]).with(:rack).returns(:true)
388-
Puppet.features.stubs(:root?).returns true
389-
a_user_type_for("puppet").expects(:exists?).returns true
390-
Puppet::Util.expects(:chuser)
391-
392381
Puppet.expects(:deprecation_warning).with("The Rack Puppet master server is deprecated and will be removed in a future release. Please use Puppet Server instead. See http://links.puppetlabs.com/deprecate-rack-webrick-servers for more information.")
393382

394383
@master.main

0 commit comments

Comments
 (0)