Sha256: 1beb171cac3bbbbd156ab6b7a7986646a07afb8745d60f6ed72489ca89525a78

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'spec_helper'

describe Redirus::Proxy do
  let(:nginx_pid_file) { double('nginx pid file') }
  let(:config) {
    double('worker configuration',
      nginx_pid_file: 'nginx_pid_file'
    )
  }

  before do
    allow(Redirus).to receive(:config).and_return(config)
    allow(File).to receive(:open).with('nginx_pid_file').and_yield(nginx_pid_file)
    allow(nginx_pid_file).to receive(:read).and_return('123')
  end

  it 'invokes perform action' do
    allow(Process).to receive(:kill).with(:SIGHUP, 123)
    expect(subject).to receive(:perform_action).with('param', 123, :http)
    subject.perform('param', 123, :http)
  end

  it 'restarts nginx' do
    expect(Process).to receive(:kill).with(:SIGHUP, 123)
    subject.perform('param')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redirus-0.3.1 spec/redirus/proxy_spec.rb
redirus-0.2.1 spec/redirus/proxy_spec.rb