Sha256: 79607a8e14bcda464c9d131fd7e7b19e868992230aac00ebb966a0fce77ba9aa

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Crono::Config do
  let(:config) { Crono::Config.new }
  describe '#initialize' do
    it 'should initialize with default configuration options' do
      ENV['RAILS_ENV'] = 'test'
      @config = Crono::Config.new
      expect(@config.cronotab).to be Crono::Config::CRONOTAB
      expect(@config.logfile).to be Crono::Config::LOGFILE
      expect(@config.piddir).to be Crono::Config::PIDDIR
      expect(@config.process_name).to be Crono::Config::PROCESS_NAME
      expect(@config.daemonize).to be false
      expect(@config.monitor).to be false
      expect(@config.environment).to be_eql ENV['RAILS_ENV']
    end

    describe "#pidfile" do
      subject(:pidfile) { config.pidfile }

      context "not explicity configured" do
        context "daemonize is false" do
          before { config.daemonize = false }

          specify { expect(pidfile).to be_nil }
        end
      end

      context "explicity configured" do
        let(:path) { "foo/bar/pid.pid" }

        before { config.pidfile = path }

        specify { expect(pidfile).to eq path }

        it "trys to set piddir" do
          expect(config.piddir).to eq "foo/bar"
        end

        it "trys to set process_name" do
          expect(config.process_name).to eq "pid"
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crono-2.1.0 spec/config_spec.rb
crono-2.0.1 spec/config_spec.rb
crono-2.0.0 spec/config_spec.rb