Sha256: 12514a1f7c7175db8e7f92e8ff55e66ed3de2a8d6959c9795b085e848e2922a4

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

module MCollective
  if Util.windows?
    require 'mcollective/windows_daemon'

    describe WindowsDaemon do
      describe "#daemonize_runner" do
        it "should only run on the windows platform" do
          Util.expects("windows?").returns(false)
          expect { WindowsDaemon.daemonize_runner }.to raise_error("The Windows Daemonizer should only be used on the Windows Platform")
        end

        it "should not support writing pid files" do
          expect { WindowsDaemon.daemonize_runner(true) }.to raise_error("Writing pid files are not supported on the Windows Platform")
        end

        it "should start the mainloop" do
          WindowsDaemon.expects(:mainloop)
          WindowsDaemon.daemonize_runner
        end
      end

      describe "#service_stop" do
        it "should disconnect and exit" do
          Log.expects(:info)

          connector = mock
          connector.expects(:disconnect).once

          PluginManager.expects("[]").with("connector_plugin").returns(connector)

          d = WindowsDaemon.new
          d.expects("exit!").once

          d.service_stop
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mcollective-client-2.2.4 spec/unit/windows_daemon_spec.rb
mcollective-client-2.2.3 spec/unit/windows_daemon_spec.rb
mcollective-client-2.2.2 spec/unit/windows_daemon_spec.rb
mcollective-client-2.2.1 spec/unit/windows_daemon_spec.rb
mcollective-client-2.2.0 spec/unit/windows_daemon_spec.rb
mcollective-client-2.0.0 spec/unit/windows_daemon_spec.rb
mcollective-client-1.3.3 spec/unit/windows_daemon.rb