Skip to content

Commit

Permalink
Test body size via rack lint
Browse files Browse the repository at this point in the history
This tests the fix introduced in e05dfde.
  • Loading branch information
bittersweet committed Feb 9, 2017
1 parent aee0122 commit 71c6695
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/stopwatch_spec.rb
Original file line number Diff line number Diff line change
@@ -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'}, ["<html><body>test</body></html>"]]}
Expand Down Expand Up @@ -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'}, ["<html><body>snowman ☃</body></html>"]]}
loadspeed = Rack::LoadSpeed.new(app)
request = Rack::MockRequest.new(Rack::Lint.new(loadspeed))
response = request.get('/')
expect(response.status).to eq 200
end
end

0 comments on commit 71c6695

Please sign in to comment.