Skip to content

Commit

Permalink
Add failing tests for integrating in rack
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmad Tolba <tolpa1@gmail.com>
  • Loading branch information
ahmgeek committed Sep 3, 2019
1 parent b3bbe23 commit d4f4e32
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/prometheus/integration_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# encoding: UTF-8

require 'rack/test'
require 'rack'
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'

API = Rack::Builder.new do
use Rack::Deflater
use Prometheus::Middleware::Collector
use Prometheus::Middleware::Exporter

map "/" do
run ->(_) { [200, {'Content-Type' => 'text/html'}, ['OK']] }
end
end

describe API do
include Rack::Test::Methods

let(:app) { described_class }

context 'GET /metrics' do
it 'fails on the second request' do
get '/metrics'
expect { last_response }.not_to raise_error
expect { get '/metrics' }.not_to raise_error
end
end
end

0 comments on commit d4f4e32

Please sign in to comment.