Sha256: 2e97aa132230c6b5b97f924c714cd6fedfbbfc1b3eaafbdf582b9cb977efdc30

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 Bytes

Contents

require 'spec_helper'

describe 'misc forklift core' do  

  describe 'pidfile' do
    it "can create a pidfile and will remove it when the plan is over" do
      plan = SpecPlan.new
      pid = "#{File.dirname(__FILE__)}/../../pid/pidfile"
      expect(File.exists?(pid)).to eql false
      plan.do! {
        expect(File.exists?(pid)).to eql true
        expect(File.read(pid).to_i).to eql Process.pid
      }
      plan.disconnect!
      expect(File.exists?(pid)).to eql false
    end

    it "will not run with an existing pidfile" do 
      plan = SpecPlan.new
      plan.pid.store!
      expect { plan.do! }.to raise_error SystemExit
      plan.pid.delete!
      plan.disconnect!
    end 
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
forklift_etl-1.2.2 spec/unit/misc/pid_spec.rb
forklift_etl-1.2.1 spec/unit/misc/pid_spec.rb
forklift_etl-1.2.0 spec/unit/misc/pid_spec.rb