~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to spec/unit/daemon_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-25 01:00:37 UTC
  • mfrom: (1.1.24 upstream) (3.1.25 sid)
  • Revision ID: james.westby@ubuntu.com-20110725010037-875vuxs10eboqgw3
Tags: 2.7.1-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/puppetmaster-passenger.postinst: Use cacrl instead of hostcrl to
    set the location of the CRL in apache2 configuration. Fix apache2
    configuration on upgrade as well (LP: #641001)
  - move all puppet dependencies to puppet-common since all the code
    actually located in puppet-common.
  - move libagueas from a recommend to a dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env ruby
2
 
 
3
 
require File.dirname(__FILE__) + '/../spec_helper'
 
1
#!/usr/bin/env rspec
 
2
require 'spec_helper'
4
3
require 'puppet/daemon'
5
4
 
6
5
def without_warnings
87
86
  describe "when stopping" do
88
87
    before do
89
88
      @daemon.stubs(:remove_pidfile)
90
 
      @daemon.stubs(:exit)
91
89
      Puppet::Util::Log.stubs(:close_all)
92
90
      # to make the global safe to mock, set it to a subclass of itself,
93
91
      # then restore it in an after pass
103
101
      server = mock 'server'
104
102
      server.expects(:stop)
105
103
      @daemon.stubs(:server).returns server
106
 
 
107
 
      @daemon.stop
 
104
      expect { @daemon.stop }.to exit_with 0
108
105
    end
109
106
 
110
107
    it 'should request a stop from Puppet::Application' do
111
108
      Puppet::Application.expects(:stop!)
112
 
      @daemon.stop
 
109
      expect { @daemon.stop }.to exit_with 0
113
110
    end
114
111
 
115
112
    it "should remove its pidfile" do
116
113
      @daemon.expects(:remove_pidfile)
117
 
 
118
 
      @daemon.stop
 
114
      expect { @daemon.stop }.to exit_with 0
119
115
    end
120
116
 
121
117
    it "should close all logs" do
122
118
      Puppet::Util::Log.expects(:close_all)
123
 
 
124
 
      @daemon.stop
 
119
      expect { @daemon.stop }.to exit_with 0
125
120
    end
126
121
 
127
122
    it "should exit unless called with ':exit => false'" do
128
 
      @daemon.expects(:exit)
129
 
      @daemon.stop
 
123
      expect { @daemon.stop }.to exit_with 0
130
124
    end
131
125
 
132
126
    it "should not exit if called with ':exit => false'" do
133
 
      @daemon.expects(:exit).never
134
127
      @daemon.stop :exit => false
135
128
    end
136
129
  end