Sha256: 75708ff0c63a5be7d951750e27e8f32a938195e570d5e71d967b4530482746f5

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8
describe ServerCommands::Rackup do

  context '#initialize' do
    it 'requires a listen statement' do
      pid_file    = create_file 'pid', $$
      config_file = create_file 'config.ru'

      expect {
        ServerCommands::Rackup.new(
          listen: 'localhost:8080',
          pid_file: pid_file,
          config_file: config_file,
        )
      }.not_to raise_error
    end
  end

  context '#to_s' do
    it 'has defaults' do
      command = ServerCommands::Rackup.new
      expect(command.to_s).to eq("rackup -E development -P #{LocalPac.config.pid_file} -o 127.0.0.1 -p 8080 #{File.expand_path('../../../config.ru', __FILE__)}")
    end

    it 'respects changed environment' do
      command = ServerCommands::Rackup.new(
        environment: '-E super_env'
      )

      expect(command.to_s).to include('-E super_env')
    end

    it 'respects changed pid file' do
      pid_file    = create_file 'pid', $$

      command = ServerCommands::Rackup.new(
        pid_file: pid_file,
      )

      expect(command.to_s).to include("-P #{pid_file}")
    end

    it 'respects changed config_file' do
      config_file = create_file 'config.ru'

      command = ServerCommands::Rackup.new(
        config_file: config_file,
      )

      expect(command.to_s).to include(config_file)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/server_commands/rackup_spec.rb
local_pac-0.10.1 spec/server_commands/rackup_spec.rb
local_pac-0.10.0 spec/server_commands/rackup_spec.rb
local_pac-0.9.0 spec/server_commands/rackup_spec.rb
local_pac-0.7.0 spec/server_commands/rackup_spec.rb
local_pac-0.6.3 spec/server_commands/rackup_spec.rb
local_pac-0.6.2 spec/server_commands/rackup_spec.rb
local_pac-0.6.1 spec/server_commands/rackup_spec.rb
local_pac-0.5.0 spec/server_commands/rackup_spec.rb
local_pac-0.4.0 spec/server_commands/rackup_spec.rb
local_pac-0.3.0 spec/server_commands/rackup_spec.rb