spec/unit/rack/logs/viewer_spec.rb in rack-logs-0.0.5 vs spec/unit/rack/logs/viewer_spec.rb in rack-logs-0.0.6

- old
+ new

@@ -1,5 +1,6 @@ +require 'timeout' require 'rack/logs/viewer' describe 'Rack::Logs::Viewer' do let(:config) do instance_double "Rack::Logs::Config", lines: 5, pattern: '*.doge', @@ -13,9 +14,17 @@ end describe '#call env' do let(:viewer) { Rack::Logs::Viewer.new config } let(:contents) { response[2].inject("") { |contents, fragment| contents + fragment } } + + around do |example| + begin + Timeout::timeout(0.01) { example.run } + rescue Timeout::Error + fail "Performance regression, even large files should be under .01s" + end + end shared_examples_for "a rack logs response" do it 'returns a rack response' do expect(response[0]).to be_a Fixnum expect(response[1]).to be_a Hash