Sha256: f8243eea5dfcdc51cd06e6d6aa57b387e69ad03d195d84d30d434e1b9997e3b7

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

require 'spec_helper'

describe Redcap do
  describe '.pid_for_port' do
    let(:socket) { stub('socket', :write => nil, :read => '42', :close => nil) }
    
    before :each do
      TCPSocket.stub! :new => socket
    end
    
    it "sends the given port to the socket" do
      socket.should_receive(:write).with("101\n")
      
      Redcap.pid_for_port(101)
    end
    
    it "returns the socket output as an integer" do
      Redcap.pid_for_port(101).should == 42
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcap-0.1.1 spec/redcap_spec.rb
redcap-0.1.0 spec/redcap_spec.rb