From 71c66953520be7dc23d638a30b8200ce44d697a4 Mon Sep 17 00:00:00 2001 From: Mark Mulder Date: Thu, 9 Feb 2017 12:06:31 +0100 Subject: [PATCH] Test body size via rack lint This tests the fix introduced in e05dfde. --- spec/stopwatch_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/stopwatch_spec.rb b/spec/stopwatch_spec.rb index e999bfe..e2a8de3 100644 --- a/spec/stopwatch_spec.rb +++ b/spec/stopwatch_spec.rb @@ -1,6 +1,11 @@ +# encoding: utf-8 +# require_relative './../lib/stopwatch' require_relative './../lib/load_speed' +require 'rack/lint' +require "rack/mock" + describe Rack::LoadSpeed do it 'inserts performance data' do app = lambda { |env| [200, {'Content-Type' => 'text/html'}, ["test"]]} @@ -29,4 +34,12 @@ body = response[2][0] expect(body).to eq "{'id': '1'}" end + + it 'check content-length via Rack::Lint' do + app = lambda { |env| [200, {'Content-Type' => 'text/html'}, ["snowman ☃"]]} + loadspeed = Rack::LoadSpeed.new(app) + request = Rack::MockRequest.new(Rack::Lint.new(loadspeed)) + response = request.get('/') + expect(response.status).to eq 200 + end end