Sha256: 0fe7f1986509442c72a6d9239756ea13ef31024eacd2c53e7a07639a91515538

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'
require 'fileutils'

describe 'Fluentd::Agent::LocalCommon' do
  subject { target_class.new.tap{|t| t.pid_file = pid_file_path} }

  let!(:target_class) { Struct.new(:pid_file){ include Fluentd::Agent::LocalCommon } }
  let!(:pid_file_path) { Rails.root.join('tmp', 'fluentd-test', 'local_common_test.pid').to_s }

  describe '#pid' do
    context 'no pid file exists' do
      its(:pid) { should be_nil }
    end

    context 'empty pid file given' do
      before { FileUtils.touch pid_file_path }
      after  { FileUtils.rm pid_file_path }

      its(:pid) { should be_nil }
    end

    context 'valid pid file given' do
      before { File.write pid_file_path, '9999' }
      after  { FileUtils.rm pid_file_path }

      its(:pid) { should eq(9999) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluentd-ui-0.3.10 spec/models/fluentd/agent/local_common_spec.rb