Sha256: 9cc5ef9fc7a504534c15fa21b96e9dd359a603b0251eb860dc02487e01ad91e5

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require_relative '../spec_helper'

feature 'server process with port allocation', subject: :http_process_ready_variables do
	scenario 'allocating port for new process instance form pool' do
		instance = subject.with do |process|
			process.http_port_allocated_form 1400, 4
		end.instance

		expect(instance.ports).to contain_exactly 1400, 1401, 1402, 1403
	end

	scenario 'new ports allocated for new instance' do
		# use up a port
		subject.with do |process|
			process.http_port_allocated_form 1500, 1
		end.instance

		instance = subject.with do |process|
			process.argument 'foo'
			process.http_port_allocated_form 1500, 1
		end.instance

		expect(instance.ports).to contain_exactly 1501
	end

	scenario 'using port number with argument value' do
		instance = subject.with do |process|
			process.argument '--listen', 'localhost:<allocated port 1>'
			process.http_port_allocated_form 1600, 1
		end.instance
		instance.start.wait_ready

		expect(instance.log_file.read).to include('"localhost:1600"').and include('listening on port: 1600')
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-background-process-0.1.2 spec/features/server_spec.rb
rspec-background-process-0.1.1 spec/features/server_spec.rb
rspec-background-process-0.1.0 spec/features/server_spec.rb