rack-request-object-logger 3.0.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +26 -0
- data/README.md +8 -23
- data/Rakefile +8 -2
- data/examples/rails7/config/initializers/log_http_request.rb +9 -0
- data/examples/rails7/db/migrate/20240917151639_create_analytics_requests.rb +14 -0
- data/examples/rails7/models/analytics_request.rb +3 -0
- data/lib/rack-request-object-logger/version.rb +1 -1
- data/lib/rack-request-object-logger.rb +2 -3
- data/rack-request-object-logger.gemspec +18 -12
- metadata +32 -45
- data/.travis.yml +0 -18
- data/examples/rails5/app/models/http_request.rb +0 -3
- data/examples/rails5/config/log_http_request.rb +0 -1
- data/examples/rails5/db/migrate/20170211004327_create_http_requests.rb +0 -15
- data/performance/active_record_model_spec.rb +0 -41
- data/performance/in_memory_model_spec.rb +0 -20
- data/performance/performance_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2df7642c85cddc3a1947c7d3b7191fcbee553877a19ca47ffd9b3a46a5bc0fa
|
4
|
+
data.tar.gz: 571cf74cb5555caf7d620c109e9b037cbf3a6330a44b354e44e5b1fd2c89b3b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b43ceb51e1f0db58d96b83988a925e790b9dd5051acd203e980c0b4b3962976669f23518129c4d155619ad25f100f6d3c71cd0ec655657d5d7031370b24a4c0e
|
7
|
+
data.tar.gz: 12254a4a8c854a1da0583c5a329e229f5169f8b538023732c693b7a8ca2abc3db7a490c6914c7950946c544e5933930179499e4d1e2d42f9a2b765b9262841b5
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: github-actions-rails
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches: ['*']
|
6
|
+
push:
|
7
|
+
branches: [master]
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', head, truffleruby, truffleruby-head]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
bundler: default
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Run tests
|
24
|
+
env:
|
25
|
+
RAILS_ENV: test
|
26
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
|
1
|
+
![example workflow](https://github.com/istana/rack-request-object-logger/actions/workflows/ruby.yml/badge.svg)
|
2
2
|
[![Gem Version](http://img.shields.io/gem/v/rack-request-object-logger.svg?style=flat-square)](https://rubygems.org/gems/rack-request-object-logger)
|
3
3
|
[![License](http://img.shields.io/:license-apache-blue.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html)
|
4
4
|
|
5
5
|
# rack-request-object-logger
|
6
6
|
|
7
|
-
|
7
|
+
The project is a Rack middleware to automatically log a HTTP request to a custom object.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
Don't be confused with no commits in months or years. Rack middlewares rarely change. They just work.
|
9
|
+
There might be no commits in months or years. Rack middlewares rarely change.
|
12
10
|
|
13
11
|
## Install gem
|
14
12
|
|
@@ -24,9 +22,9 @@ gem 'rack-request-object-logger'
|
|
24
22
|
|
25
23
|
## Rubies Support
|
26
24
|
|
27
|
-
Tested with Matz Ruby 2.
|
25
|
+
Tested with Matz Ruby 2.7, 3.0, 3.1, 3.2, 3.3, head, and ruffleruby, truffleruby-head.
|
28
26
|
|
29
|
-
Should work with
|
27
|
+
Should work also with jRuby, just sqlite3 adapter supports only Rails 7 and tests require a more recent Rails.
|
30
28
|
|
31
29
|
## Roadmap
|
32
30
|
|
@@ -39,26 +37,13 @@ Bug: I learned at EuRuKo 2018 that my implementation of timings is wrong and not
|
|
39
37
|
generate a model for storage
|
40
38
|
|
41
39
|
```bash
|
42
|
-
|
43
|
-
# to have subsecond resolution please see examples/db/migrate/
|
44
|
-
$ bin/rails g model AnalyticsHttpRequest uid:string data:text status_code:integer application_server_request_start:datetime application_server_request_end:datetime
|
45
|
-
|
46
|
-
```
|
47
|
-
|
48
|
-
add JSON serialization
|
49
|
-
|
50
|
-
```ruby
|
51
|
-
# app/models/analytics_http_request.rb
|
52
|
-
class AnalyticsHttpRequest < ApplicationRecord
|
53
|
-
serialize :data, JSON
|
54
|
-
end
|
55
|
-
|
40
|
+
$ bin/rails g model AnalyticsRequest uid:string data:jsonb status_code:integer application_server_request_start:datetime application_server_request_end:datetime
|
56
41
|
```
|
57
42
|
|
58
43
|
add automatic logging via initializer
|
59
44
|
|
60
45
|
```ruby
|
61
|
-
# config/initializers/
|
46
|
+
# config/initializers/log_requests.rb
|
62
47
|
|
63
48
|
Rails.application.config.middleware.use(RackRequestObjectLogger, AnalyticsHttpRequest)
|
64
49
|
```
|
@@ -79,7 +64,7 @@ I've seen applications sending sensitive data in GET and even POST requests in a
|
|
79
64
|
|
80
65
|
## License & Author
|
81
66
|
|
82
|
-
Copyright 2016-
|
67
|
+
Copyright 2016-2024 Ivan Stana
|
83
68
|
|
84
69
|
Licensed under the Apache License, Version 2.0 (the "License");
|
85
70
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
+
t.pattern = 'spec'
|
6
|
+
end
|
5
7
|
|
6
|
-
|
8
|
+
RSpec::Core::RakeTask.new(:spec_performance) do |t|
|
9
|
+
t.pattern = 'performance'
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => [:spec, :spec_performance]
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require Rails.root.join('app', 'models', 'application_record').to_s
|
2
|
+
require Rails.root.join('app', 'models', 'analytics_request').to_s
|
3
|
+
|
4
|
+
Rails.configuration.before_initialize do
|
5
|
+
Rails.application.config.middleware.use(
|
6
|
+
RackRequestObjectLogger,
|
7
|
+
::AnalyticsRequest
|
8
|
+
)
|
9
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateAnalyticsRequests < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :analytics_requests, id: :uuid do |t|
|
4
|
+
t.text :uid
|
5
|
+
t.json :data
|
6
|
+
t.integer :status_code
|
7
|
+
t.datetime :application_server_request_start
|
8
|
+
t.datetime :application_server_request_end
|
9
|
+
t.references :requestable, polymorphic: true, null: true, type: :uuid, index: true
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -17,8 +17,7 @@ class RackRequestObjectLogger
|
|
17
17
|
logger_object = @model.new
|
18
18
|
logger_object.application_server_request_start = start_time
|
19
19
|
logger_object.application_server_request_end = end_time
|
20
|
-
|
21
|
-
logger_object.data = request.env.select do |header, value|
|
20
|
+
logger_object.data = env.select do |header, value|
|
22
21
|
# don't bother with values other than a string
|
23
22
|
next if !value.is_a?(String)
|
24
23
|
# https://tools.ietf.org/html/rfc3875 CGI 1.1 spec
|
@@ -38,7 +37,7 @@ class RackRequestObjectLogger
|
|
38
37
|
].include?(header) || ['HTTP', 'HTTPS'].include?(header) || header =~ /\AHTTP_\w+\z/ ||
|
39
38
|
['REQUEST_URI', 'ORIGINAL_FULLPATH', 'ORIGINAL_SCRIPT_NAME'].include?(header)
|
40
39
|
end
|
41
|
-
logger_object.uid =
|
40
|
+
logger_object.uid = env['action_dispatch.request_id'] || SecureRandom.uuid
|
42
41
|
logger_object.status_code = app_result.first
|
43
42
|
logger_object.save
|
44
43
|
app_result
|
@@ -11,25 +11,31 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ["Ivan Stana"]
|
12
12
|
spec.email = ["ronon@myrtana.sk"]
|
13
13
|
|
14
|
-
spec.summary = %q{
|
15
|
-
spec.description = %q{
|
16
|
-
spec.homepage = "https://github.com/
|
14
|
+
spec.summary = %q{The project is a Rack middleware to automatically log a HTTP request to a custom object.}
|
15
|
+
spec.description = %q{The project is a Rack middleware to automatically log a HTTP request to a custom object.}
|
16
|
+
spec.homepage = "https://github.com/istana/rack-request-object-logger"
|
17
17
|
spec.license = "Apache-2.0"
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
|
-
f.match(%r{^(test|spec|features)/})
|
20
|
+
f.match(%r{^(test|spec|features|performance)/})
|
21
21
|
end
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
22
|
spec.require_paths = ["lib"]
|
25
23
|
|
26
|
-
spec.
|
24
|
+
spec.metadata = {
|
25
|
+
"bug_tracker_uri" => "https://github.com/istana/rack-request-object-logger/issues",
|
26
|
+
"homepage_uri" => "https://github.com/istana/rack-request-object-logger",
|
27
|
+
"source_code_uri" => "https://github.com/istana/rack-request-object-logger",
|
28
|
+
}
|
29
|
+
|
30
|
+
spec.add_dependency "rack", "> 0", "< 4.0"
|
27
31
|
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
-
spec.add_development_dependency "rake", "~>
|
29
|
-
spec.add_development_dependency "rspec", "~> 3.
|
32
|
+
spec.add_development_dependency "rake", "~> 13"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
30
34
|
spec.add_development_dependency "rspec-benchmark", "~> 0"
|
31
35
|
spec.add_development_dependency "pry", "~> 0"
|
32
|
-
spec.add_development_dependency "activerecord", '>= 6.0', "<
|
33
|
-
spec.add_development_dependency "sqlite3", "
|
34
|
-
spec.add_development_dependency "mysql2", "~> 0.5" unless RUBY_PLATFORM == 'java'
|
36
|
+
spec.add_development_dependency "activerecord", '>= 6.0', "< 8.0"
|
37
|
+
spec.add_development_dependency "sqlite3", "<= 2.1" unless RUBY_PLATFORM == "java"
|
35
38
|
end
|
39
|
+
|
40
|
+
|
41
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-request-object-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Stana
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '4.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '4.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,28 +50,28 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '13'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '13'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '3.
|
67
|
+
version: '3.13'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '3.
|
74
|
+
version: '3.13'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rspec-benchmark
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '6.0'
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
112
|
+
version: '8.0'
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -119,46 +119,32 @@ dependencies:
|
|
119
119
|
version: '6.0'
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
122
|
+
version: '8.0'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: sqlite3
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "
|
127
|
+
- - "<="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '1
|
129
|
+
version: '2.1'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- - "
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '1.4'
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: mysql2
|
139
|
-
requirement: !ruby/object:Gem::Requirement
|
140
|
-
requirements:
|
141
|
-
- - "~>"
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '0.5'
|
144
|
-
type: :development
|
145
|
-
prerelease: false
|
146
|
-
version_requirements: !ruby/object:Gem::Requirement
|
147
|
-
requirements:
|
148
|
-
- - "~>"
|
134
|
+
- - "<="
|
149
135
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
151
|
-
description:
|
152
|
-
|
136
|
+
version: '2.1'
|
137
|
+
description: The project is a Rack middleware to automatically log a HTTP request
|
138
|
+
to a custom object.
|
153
139
|
email:
|
154
140
|
- ronon@myrtana.sk
|
155
141
|
executables: []
|
156
142
|
extensions: []
|
157
143
|
extra_rdoc_files: []
|
158
144
|
files:
|
145
|
+
- ".github/workflows/ruby.yml"
|
159
146
|
- ".gitignore"
|
160
147
|
- ".rspec"
|
161
|
-
- ".travis.yml"
|
162
148
|
- CODE_OF_CONDUCT.md
|
163
149
|
- Gemfile
|
164
150
|
- LICENSE
|
@@ -166,20 +152,20 @@ files:
|
|
166
152
|
- Rakefile
|
167
153
|
- bin/console
|
168
154
|
- bin/setup
|
169
|
-
- examples/
|
170
|
-
- examples/
|
171
|
-
- examples/
|
155
|
+
- examples/rails7/config/initializers/log_http_request.rb
|
156
|
+
- examples/rails7/db/migrate/20240917151639_create_analytics_requests.rb
|
157
|
+
- examples/rails7/models/analytics_request.rb
|
172
158
|
- lib/rack-request-object-logger.rb
|
173
159
|
- lib/rack-request-object-logger/version.rb
|
174
|
-
- performance/active_record_model_spec.rb
|
175
|
-
- performance/in_memory_model_spec.rb
|
176
|
-
- performance/performance_helper.rb
|
177
160
|
- rack-request-object-logger.gemspec
|
178
|
-
homepage: https://github.com/
|
161
|
+
homepage: https://github.com/istana/rack-request-object-logger
|
179
162
|
licenses:
|
180
163
|
- Apache-2.0
|
181
|
-
metadata:
|
182
|
-
|
164
|
+
metadata:
|
165
|
+
bug_tracker_uri: https://github.com/istana/rack-request-object-logger/issues
|
166
|
+
homepage_uri: https://github.com/istana/rack-request-object-logger
|
167
|
+
source_code_uri: https://github.com/istana/rack-request-object-logger
|
168
|
+
post_install_message:
|
183
169
|
rdoc_options: []
|
184
170
|
require_paths:
|
185
171
|
- lib
|
@@ -194,8 +180,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
180
|
- !ruby/object:Gem::Version
|
195
181
|
version: '0'
|
196
182
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
-
signing_key:
|
183
|
+
rubygems_version: 3.5.16
|
184
|
+
signing_key:
|
199
185
|
specification_version: 4
|
200
|
-
summary:
|
186
|
+
summary: The project is a Rack middleware to automatically log a HTTP request to a
|
187
|
+
custom object.
|
201
188
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
services:
|
4
|
-
- mysql
|
5
|
-
rvm:
|
6
|
-
- 2.5.4
|
7
|
-
- 2.6.3
|
8
|
-
- truffleruby
|
9
|
-
before_install:
|
10
|
-
- gem update --system
|
11
|
-
- gem install bundler
|
12
|
-
cache: bundler
|
13
|
-
matrix:
|
14
|
-
include:
|
15
|
-
- rvm: ruby-head
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
fast_finish: true
|
@@ -1 +0,0 @@
|
|
1
|
-
Rails.application.config.middleware.use "RackRequestObjectLogger", AnalyticsHttpRequest
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateAnalyticsHttpRequests < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
create_table :analytics_http_requests do |t|
|
4
|
-
t.string :uid
|
5
|
-
t.text :data
|
6
|
-
t.integer :status_code
|
7
|
-
# with limit: 6 we will store nanosecond resolution
|
8
|
-
# for statistics and performance monitoring sub-second resolution is a must
|
9
|
-
t.datetime :application_server_request_start, limit: 6
|
10
|
-
t.datetime :application_server_request_end, limit: 6
|
11
|
-
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'performance_helper'
|
3
|
-
require_relative '../spec/spec_data'
|
4
|
-
require 'active_record'
|
5
|
-
|
6
|
-
RSpec.describe "Performance testing with an ActiveRecord class and SQLite3 database", performance: true do
|
7
|
-
include RSpec::Benchmark::Matchers
|
8
|
-
include_context 'spec_data'
|
9
|
-
|
10
|
-
class RequestActiveRecordLog < ActiveRecord::Base
|
11
|
-
serialize :headers, JSON
|
12
|
-
end
|
13
|
-
|
14
|
-
class CreateRequestActiveRecordLog < ActiveRecord::Migration[4.2]
|
15
|
-
def change
|
16
|
-
create_table :request_active_record_logs do |t|
|
17
|
-
t.integer :uid
|
18
|
-
t.text :data
|
19
|
-
t.time :application_server_request_start
|
20
|
-
t.time :application_server_request_end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
let(:app) { proc{ [200, {}, ['Hello, world.']] } }
|
26
|
-
let(:stack) { RackRequestObjectLogger.new(app, RequestActiveRecordLog) }
|
27
|
-
let(:request) { Rack::MockRequest.new(stack) }
|
28
|
-
|
29
|
-
after { File.unlink 'active_record_performance.sqlite3' }
|
30
|
-
|
31
|
-
it 'much fast. wow' do
|
32
|
-
set_headers(rails5_puma_headers)
|
33
|
-
|
34
|
-
ActiveRecord::Base.establish_connection(
|
35
|
-
adapter: 'sqlite3',
|
36
|
-
database: 'active_record_performance.sqlite3'
|
37
|
-
)
|
38
|
-
CreateRequestActiveRecordLog.migrate(:up)
|
39
|
-
expect { request.get('http://localhost:4000/doge') }.to perform_at_least(500).ips
|
40
|
-
end
|
41
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'performance_helper'
|
3
|
-
require_relative '../spec/spec_data'
|
4
|
-
|
5
|
-
RSpec.describe "Performance testing with a dummy class", performance: true do
|
6
|
-
include RSpec::Benchmark::Matchers
|
7
|
-
include_context 'spec_data'
|
8
|
-
|
9
|
-
let(:app) { proc{ [200, {}, ['Hello, world.']] } }
|
10
|
-
let(:stack) { RackRequestObjectLogger.new(app, RequestDummyLog) }
|
11
|
-
let(:request) { Rack::MockRequest.new(stack) }
|
12
|
-
|
13
|
-
let(:logger_object) { RequestDummyLog.new }
|
14
|
-
before { allow(RequestDummyLog).to receive(:new).and_return(logger_object) }
|
15
|
-
|
16
|
-
it 'much fast. wow' do
|
17
|
-
set_headers(rails5_puma_headers)
|
18
|
-
expect { request.get('http://localhost:4000/doge') }.to perform_at_least(5000).ips
|
19
|
-
end
|
20
|
-
end
|