Sha256: 0c64de737d04bb6c483b3b3bfbeae7238c3059426ef064fb1166bf06c7624344

Contents?: true

Size: 990 Bytes

Versions: 7

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

require 'vagrant-notify/action/stop_server'

describe Vagrant::Notify::Action::StopServer do
  let(:app)          { lambda { |env| } }
  let(:config)       { mock(notify: stub(enable: true)) }
  let(:communicator) { mock(sudo: true) }
  let(:ui)           { mock(success: true) }
  let(:machine)      { mock(communicate: communicator, state: stub(id: :running), ui: ui, config: config) }
  let(:env)          { {notify_data: {pid: pid, port: 1234}, machine: machine} }
  let(:pid)          { '42' }
  let(:port)         { described_class::PORT }

  subject { described_class.new(app, env) }

  before do
    Process.stub(kill: true)
    subject.call(env)
  end

  it 'kills the notification server' do
    Process.should have_received(:kill).with('KILL', pid.to_i)
  end

  it "removes server PID from notify data" do
    env[:notify_data][:pid].should be_nil
  end

  it "removes server port from notify data" do
    env[:notify_data][:port].should be_nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-notify-0.6.0 spec/action/stop_server_spec.rb
vagrant-notify-0.5.6 spec/action/stop_server_spec.rb
vagrant-notify-0.5.5 spec/action/stop_server_spec.rb
vagrant-notify-0.5.4 spec/action/stop_server_spec.rb
vagrant-notify-0.5.3 spec/action/stop_server_spec.rb
vagrant-notify-0.5.2 spec/action/stop_server_spec.rb
vagrant-notify-0.5.1 spec/action/stop_server_spec.rb