Sha256: 8c4fcadcc2e7b24af25102fdccedfbca687e11472c675a658eb1448d8646981b

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Rack::HerokuEnv do
  let(:app) { lambda { |env| [200, { 'Content-Type' => 'text/plain' }, 'Hello'] } }
  let(:env_vars) {
    {
      'HTTP_X_HEROKU_DYNOS_IN_USE' => '1',
      'HTTP_X_HEROKU_QUEUE_DEPTH' => '2',
      'HTTP_X_HEROKU_QUEUE_WAIT_TIME' => '3',
    }
  }
  let(:env) { Rack::MockRequest.env_for('/', env_vars) }

  before { _, @headers, _ = Rack::HerokuEnv.new(app).call(env) }

  it 'adds X-Heroku-Dynos-In-Use response header' do
    @headers.should be_include('X-Heroku-Dynos-In-Use')
  end

  it 'adds X-Heroku-Queue-Depth response header' do
    @headers.should be_include('X-Heroku-Queue-Depth')
  end

  it 'adds X-Heroku-Queue-Wait-Time response header' do
    @headers.should be_include('X-Heroku-Queue-Wait-Time')
  end

  it 'sets HTTP_X_HEROKU_DYNOS_IN_USE value to response header' do
    @headers['X-Heroku-Dynos-In-Use'].should eq('1')
  end

  it 'sets HTTP_X_HEROKU_QUEUE_DEPTH value to response header' do
    @headers['X-Heroku-Queue-Depth'].should eq('2')
  end

  it 'sets HTTP_X_HEROKU_QUEUE_WAIT_TIME value to response header' do
    @headers['X-Heroku-Queue-Wait-Time'].should eq('3')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-heroku_env-0.1.0 spec/rack-heroku_env_spec.rb
rack-heroku_env-0.0.1 spec/rack-heroku_env_spec.rb