File: server_spec.rb

package info (click to toggle)
ruby-raemon 0.3.0%2Bgit.2012.05.18.b78eaae57c-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 204 kB
  • sloc: ruby: 901; makefile: 4
file content (51 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'spec_helper'

describe Raemon::Server do
  describe '.boot!' do
    before(:each) do
      subject.stub(:load_environment)
      subject.stub(:load_initializers)
      subject.stub(:load_lib)
      subject.stub(:initialize_logger)
    end

    it 'loads the environment configuration' do
      subject.should_receive(:load_environment)
      subject.boot!
    end

    it 'loads any initializers' do
      subject.should_receive(:load_initializers)
      subject.boot!
    end

    it 'loads library files' do
      subject.should_receive(:load_lib)
      subject.boot!
    end
  end

  describe '.startup!' do
    before(:all) do
      # Stupid config to silence some aspects we don't care about
      Raemon.config do |c|
        c.worker_class = 'String'
      end
    end

    before(:each) do
      Raemon::Master.stub(:start)
    end

    it 'starts the master daemon' do
      Raemon::Master.should_receive(:start)
      subject.startup!
    end

    it 'stops the script if the master daemon is already running' do
      subject.stub(:running?) { true }
      subject.should_receive(:exit)
      subject.startup!
    end
  end
end