Sha256: f1ef4e9df92f6777d8fb34d3de35e38e64b3e3e924b814293bfd812693f7ddc7

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

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

require 'taps/server'
require 'pp'

describe Taps::Server do
  def app
    Taps::Server.new
  end

  before do
    Taps::Config.login = 'taps'
    Taps::Config.password = 'tpass'

    @app = Taps::Server
    @auth_header = 'Basic ' + ['taps:tpass'].pack('m*')
  end

  it 'asks for http basic authentication' do
    get '/'
    last_response.status.should == 401
  end

  it 'verifies the client taps version' do
    get('/', {}, 'HTTP_AUTHORIZATION' => @auth_header, 'HTTP_TAPS_VERSION' => Taps::Version.current)
    last_response.status.should == 200
  end

  it "yells loudly if the client taps version doesn't match" do
    get('/', {}, 'HTTP_AUTHORIZATION' => @auth_header, 'HTTP_TAPS_VERSION' => '0.0.1')
    last_response.status.should == 417
  end

  it 'allows healthcheck to be accessed w/o HTTP_TAPS_VERSION' do
    get('/health', {}, 'HTTP_AUTHORIZATION' => @auth_header)
    last_response.status.should == 200
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
taps2-0.6.10 spec/server_spec.rb
taps2-0.6.9 spec/server_spec.rb
taps2-0.6.8 spec/server_spec.rb
taps2-0.6.7 spec/server_spec.rb
taps2-0.6.6 spec/server_spec.rb
taps2-0.6.5 spec/server_spec.rb
taps2-0.6.4 spec/server_spec.rb
taps2-0.6.3 spec/server_spec.rb
taps2-0.6.2 spec/server_spec.rb