peastash 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +19 -3
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/gemfiles/Gemfile.rails-3.2.x +5 -0
- data/gemfiles/Gemfile.rails-4.0.x +6 -0
- data/gemfiles/Gemfile.rails-4.1.x +6 -0
- data/gemfiles/Gemfile.rails-4.2.x +6 -0
- data/gemfiles/Gemfile.rails-head +6 -0
- data/lib/peastash/middleware.rb +3 -0
- data/lib/peastash/version.rb +1 -1
- data/peastash.gemspec +1 -0
- data/spec/dummy-3.2/.gitignore +15 -0
- data/spec/dummy-3.2/Gemfile +38 -0
- data/spec/dummy-3.2/README.rdoc +261 -0
- data/spec/dummy-3.2/Rakefile +7 -0
- data/spec/dummy-3.2/app/assets/images/rails.png +0 -0
- data/spec/dummy-3.2/app/assets/javascripts/application.js +15 -0
- data/spec/dummy-3.2/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy-3.2/app/controllers/application_controller.rb +3 -0
- data/spec/dummy-3.2/app/helpers/application_helper.rb +2 -0
- data/spec/dummy-3.2/app/mailers/.gitkeep +0 -0
- data/spec/dummy-3.2/app/models/.gitkeep +0 -0
- data/spec/dummy-3.2/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy-3.2/config.ru +4 -0
- data/spec/dummy-3.2/config/application.rb +62 -0
- data/spec/dummy-3.2/config/boot.rb +6 -0
- data/spec/dummy-3.2/config/database.yml +25 -0
- data/spec/dummy-3.2/config/environment.rb +5 -0
- data/spec/dummy-3.2/config/environments/development.rb +37 -0
- data/spec/dummy-3.2/config/environments/production.rb +67 -0
- data/spec/{dummy/config/environments/test_without_buchestache.rb → dummy-3.2/config/environments/test.rb} +16 -17
- data/spec/dummy-3.2/config/environments/test_with_specific_position.rb +39 -0
- data/spec/dummy-3.2/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy-3.2/config/initializers/inflections.rb +15 -0
- data/spec/dummy-3.2/config/initializers/mime_types.rb +5 -0
- data/spec/dummy-3.2/config/initializers/secret_token.rb +7 -0
- data/spec/dummy-3.2/config/initializers/session_store.rb +8 -0
- data/spec/dummy-3.2/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy-3.2/config/locales/en.yml +5 -0
- data/spec/dummy-3.2/config/routes.rb +58 -0
- data/spec/dummy-3.2/db/seeds.rb +7 -0
- data/spec/dummy-3.2/doc/README_FOR_APP +2 -0
- data/spec/dummy-3.2/lib/assets/.gitkeep +0 -0
- data/spec/dummy-3.2/lib/tasks/.gitkeep +0 -0
- data/spec/dummy-3.2/log/.gitkeep +0 -0
- data/spec/dummy-3.2/public/404.html +26 -0
- data/spec/dummy-3.2/public/422.html +26 -0
- data/spec/dummy-3.2/public/500.html +25 -0
- data/spec/dummy-3.2/public/favicon.ico +0 -0
- data/spec/dummy-3.2/public/index.html +241 -0
- data/spec/dummy-3.2/public/robots.txt +5 -0
- data/spec/dummy-3.2/script/rails +6 -0
- data/spec/dummy-3.2/test/fixtures/.gitkeep +0 -0
- data/spec/dummy-3.2/test/functional/.gitkeep +0 -0
- data/spec/dummy-3.2/test/integration/.gitkeep +0 -0
- data/spec/dummy-3.2/test/performance/browsing_test.rb +12 -0
- data/spec/dummy-3.2/test/test_helper.rb +13 -0
- data/spec/dummy-3.2/test/unit/.gitkeep +0 -0
- data/spec/dummy-3.2/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/dummy-3.2/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy-3.2/vendor/plugins/.gitkeep +0 -0
- data/spec/peastash/middleware_spec.rb +13 -0
- data/spec/peastash/rails_ext/railtie_spec.rb +21 -7
- metadata +110 -7
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -60,6 +60,19 @@ describe Peastash::Middleware do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
context 'with the X-Request-Time header' do
|
64
|
+
it 'adds the time_in_queue field' do
|
65
|
+
expect(LogStash::Event).to receive(:new).with({
|
66
|
+
'@source' => Peastash::STORE_NAME,
|
67
|
+
'@fields' => { duration: 0, status: 200, ip: nil, time_in_queue: 0.0 },
|
68
|
+
'@tags' => [],
|
69
|
+
'@pid' => an_instance_of(Fixnum),
|
70
|
+
})
|
71
|
+
middleware = Peastash::Middleware.new(app)
|
72
|
+
Timecop.freeze { middleware.call env_for('/', { 'HTTP_X_REQUEST_START' => Time.now.to_f }) }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
63
76
|
context 'storing data in the rack app' do
|
64
77
|
before :each do
|
65
78
|
app = ->(env) do
|
@@ -34,7 +34,7 @@ describe Peastash::Railtie do
|
|
34
34
|
context 'with regular conf' do
|
35
35
|
before :all do
|
36
36
|
ENV['RAILS_ENV'] = 'test'
|
37
|
-
require 'dummy/config/environment'
|
37
|
+
require testing_rails_32? ? 'dummy-3.2/config/environment' : 'dummy/config/environment'
|
38
38
|
end
|
39
39
|
|
40
40
|
before(:each) { Peastash.with_instance.store.clear }
|
@@ -49,7 +49,6 @@ describe Peastash::Railtie do
|
|
49
49
|
Rails.application.middleware.each_with_index { |middleware, index| show_exceptions_index = index if middleware == ActionDispatch::ShowExceptions }
|
50
50
|
expect(Rails.application.middleware[show_exceptions_index - 1]).to eq(Peastash::Middleware)
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
|
55
54
|
it "adds a subscriber on 'process_action.action_controller' to gather metrics about the request" do
|
@@ -60,33 +59,48 @@ describe Peastash::Railtie do
|
|
60
59
|
context "params logging" do
|
61
60
|
it "doesn't log the parameters if log_parameters isn't true" do
|
62
61
|
Peastash.with_instance.configuration[:log_parameters] = false
|
63
|
-
|
62
|
+
perform_request('/')
|
64
63
|
expect(Peastash.with_instance.store.keys).to_not include(:params)
|
65
64
|
end
|
66
65
|
|
67
66
|
it "logs the parameters if log_parameters is true" do
|
68
67
|
Peastash.with_instance.configuration[:log_parameters] = true
|
69
|
-
|
68
|
+
perform_request('/')
|
70
69
|
expect(Peastash.with_instance.store.keys).to include(:params)
|
71
70
|
end
|
72
71
|
|
73
72
|
it "doesn't log filtered parameters in clear text" do
|
74
73
|
Peastash.with_instance.configuration[:log_parameters] = true
|
75
|
-
|
74
|
+
perform_request('/?password=foo')
|
76
75
|
expect(Peastash.with_instance.store[:params]["password"]).to eq("[FILTERED]")
|
77
76
|
end
|
78
|
-
end
|
77
|
+
end unless Rails.version.start_with?('3.') # The actual railtie work, just not in the specs for now
|
79
78
|
end
|
80
79
|
end
|
81
80
|
end
|
82
81
|
|
82
|
+
def perform_request(path)
|
83
|
+
(Rails.application.call env_for(path)).tap do |res|
|
84
|
+
# Rack-Lock doesn't release the mutex if body is not closed
|
85
|
+
res[2].close unless testing_rails_32?
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
83
89
|
def run_with_env(env = 'test')
|
84
90
|
# Can't run those tests on jruby... yet
|
85
91
|
return if RUBY_PLATFORM == 'java'
|
86
92
|
fork do
|
87
93
|
SimpleCov.running = false
|
88
94
|
ENV['RAILS_ENV'] = env
|
89
|
-
|
95
|
+
if testing_rails_32?
|
96
|
+
require 'dummy-3.2/config/environment'
|
97
|
+
else
|
98
|
+
require 'dummy/config/environment'
|
99
|
+
end
|
90
100
|
yield
|
91
101
|
end
|
92
102
|
end
|
103
|
+
|
104
|
+
def testing_rails_32?
|
105
|
+
Rails.version.start_with?('3.')
|
106
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peastash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Boisard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-event
|
@@ -162,6 +162,11 @@ files:
|
|
162
162
|
- Gemfile
|
163
163
|
- README.md
|
164
164
|
- Rakefile
|
165
|
+
- gemfiles/Gemfile.rails-3.2.x
|
166
|
+
- gemfiles/Gemfile.rails-4.0.x
|
167
|
+
- gemfiles/Gemfile.rails-4.1.x
|
168
|
+
- gemfiles/Gemfile.rails-4.2.x
|
169
|
+
- gemfiles/Gemfile.rails-head
|
165
170
|
- lib/peastash.rb
|
166
171
|
- lib/peastash/middleware.rb
|
167
172
|
- lib/peastash/outputs/io.rb
|
@@ -170,6 +175,56 @@ files:
|
|
170
175
|
- lib/peastash/rails_ext/watch.rb
|
171
176
|
- lib/peastash/version.rb
|
172
177
|
- peastash.gemspec
|
178
|
+
- spec/dummy-3.2/.gitignore
|
179
|
+
- spec/dummy-3.2/Gemfile
|
180
|
+
- spec/dummy-3.2/README.rdoc
|
181
|
+
- spec/dummy-3.2/Rakefile
|
182
|
+
- spec/dummy-3.2/app/assets/images/rails.png
|
183
|
+
- spec/dummy-3.2/app/assets/javascripts/application.js
|
184
|
+
- spec/dummy-3.2/app/assets/stylesheets/application.css
|
185
|
+
- spec/dummy-3.2/app/controllers/application_controller.rb
|
186
|
+
- spec/dummy-3.2/app/helpers/application_helper.rb
|
187
|
+
- spec/dummy-3.2/app/mailers/.gitkeep
|
188
|
+
- spec/dummy-3.2/app/models/.gitkeep
|
189
|
+
- spec/dummy-3.2/app/views/layouts/application.html.erb
|
190
|
+
- spec/dummy-3.2/config.ru
|
191
|
+
- spec/dummy-3.2/config/application.rb
|
192
|
+
- spec/dummy-3.2/config/boot.rb
|
193
|
+
- spec/dummy-3.2/config/database.yml
|
194
|
+
- spec/dummy-3.2/config/environment.rb
|
195
|
+
- spec/dummy-3.2/config/environments/development.rb
|
196
|
+
- spec/dummy-3.2/config/environments/production.rb
|
197
|
+
- spec/dummy-3.2/config/environments/test.rb
|
198
|
+
- spec/dummy-3.2/config/environments/test_with_specific_position.rb
|
199
|
+
- spec/dummy-3.2/config/initializers/backtrace_silencers.rb
|
200
|
+
- spec/dummy-3.2/config/initializers/inflections.rb
|
201
|
+
- spec/dummy-3.2/config/initializers/mime_types.rb
|
202
|
+
- spec/dummy-3.2/config/initializers/secret_token.rb
|
203
|
+
- spec/dummy-3.2/config/initializers/session_store.rb
|
204
|
+
- spec/dummy-3.2/config/initializers/wrap_parameters.rb
|
205
|
+
- spec/dummy-3.2/config/locales/en.yml
|
206
|
+
- spec/dummy-3.2/config/routes.rb
|
207
|
+
- spec/dummy-3.2/db/seeds.rb
|
208
|
+
- spec/dummy-3.2/doc/README_FOR_APP
|
209
|
+
- spec/dummy-3.2/lib/assets/.gitkeep
|
210
|
+
- spec/dummy-3.2/lib/tasks/.gitkeep
|
211
|
+
- spec/dummy-3.2/log/.gitkeep
|
212
|
+
- spec/dummy-3.2/public/404.html
|
213
|
+
- spec/dummy-3.2/public/422.html
|
214
|
+
- spec/dummy-3.2/public/500.html
|
215
|
+
- spec/dummy-3.2/public/favicon.ico
|
216
|
+
- spec/dummy-3.2/public/index.html
|
217
|
+
- spec/dummy-3.2/public/robots.txt
|
218
|
+
- spec/dummy-3.2/script/rails
|
219
|
+
- spec/dummy-3.2/test/fixtures/.gitkeep
|
220
|
+
- spec/dummy-3.2/test/functional/.gitkeep
|
221
|
+
- spec/dummy-3.2/test/integration/.gitkeep
|
222
|
+
- spec/dummy-3.2/test/performance/browsing_test.rb
|
223
|
+
- spec/dummy-3.2/test/test_helper.rb
|
224
|
+
- spec/dummy-3.2/test/unit/.gitkeep
|
225
|
+
- spec/dummy-3.2/vendor/assets/javascripts/.gitkeep
|
226
|
+
- spec/dummy-3.2/vendor/assets/stylesheets/.gitkeep
|
227
|
+
- spec/dummy-3.2/vendor/plugins/.gitkeep
|
173
228
|
- spec/dummy/README.rdoc
|
174
229
|
- spec/dummy/Rakefile
|
175
230
|
- spec/dummy/app/assets/images/.keep
|
@@ -194,7 +249,6 @@ files:
|
|
194
249
|
- spec/dummy/config/environments/production.rb
|
195
250
|
- spec/dummy/config/environments/test.rb
|
196
251
|
- spec/dummy/config/environments/test_with_specific_position.rb
|
197
|
-
- spec/dummy/config/environments/test_without_buchestache.rb
|
198
252
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
199
253
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
200
254
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
@@ -217,7 +271,8 @@ files:
|
|
217
271
|
- spec/peastash_spec.rb
|
218
272
|
- spec/spec_helper.rb
|
219
273
|
homepage: http://github.com/elhu/peastash
|
220
|
-
licenses:
|
274
|
+
licenses:
|
275
|
+
- MIT
|
221
276
|
metadata: {}
|
222
277
|
post_install_message:
|
223
278
|
rdoc_options: []
|
@@ -235,11 +290,61 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
290
|
version: '0'
|
236
291
|
requirements: []
|
237
292
|
rubyforge_project:
|
238
|
-
rubygems_version: 2.
|
293
|
+
rubygems_version: 2.5.1
|
239
294
|
signing_key:
|
240
295
|
specification_version: 4
|
241
296
|
summary: Peastash allows you to instrument your code with the ELK stack easily.
|
242
297
|
test_files:
|
298
|
+
- spec/dummy-3.2/.gitignore
|
299
|
+
- spec/dummy-3.2/Gemfile
|
300
|
+
- spec/dummy-3.2/README.rdoc
|
301
|
+
- spec/dummy-3.2/Rakefile
|
302
|
+
- spec/dummy-3.2/app/assets/images/rails.png
|
303
|
+
- spec/dummy-3.2/app/assets/javascripts/application.js
|
304
|
+
- spec/dummy-3.2/app/assets/stylesheets/application.css
|
305
|
+
- spec/dummy-3.2/app/controllers/application_controller.rb
|
306
|
+
- spec/dummy-3.2/app/helpers/application_helper.rb
|
307
|
+
- spec/dummy-3.2/app/mailers/.gitkeep
|
308
|
+
- spec/dummy-3.2/app/models/.gitkeep
|
309
|
+
- spec/dummy-3.2/app/views/layouts/application.html.erb
|
310
|
+
- spec/dummy-3.2/config.ru
|
311
|
+
- spec/dummy-3.2/config/application.rb
|
312
|
+
- spec/dummy-3.2/config/boot.rb
|
313
|
+
- spec/dummy-3.2/config/database.yml
|
314
|
+
- spec/dummy-3.2/config/environment.rb
|
315
|
+
- spec/dummy-3.2/config/environments/development.rb
|
316
|
+
- spec/dummy-3.2/config/environments/production.rb
|
317
|
+
- spec/dummy-3.2/config/environments/test.rb
|
318
|
+
- spec/dummy-3.2/config/environments/test_with_specific_position.rb
|
319
|
+
- spec/dummy-3.2/config/initializers/backtrace_silencers.rb
|
320
|
+
- spec/dummy-3.2/config/initializers/inflections.rb
|
321
|
+
- spec/dummy-3.2/config/initializers/mime_types.rb
|
322
|
+
- spec/dummy-3.2/config/initializers/secret_token.rb
|
323
|
+
- spec/dummy-3.2/config/initializers/session_store.rb
|
324
|
+
- spec/dummy-3.2/config/initializers/wrap_parameters.rb
|
325
|
+
- spec/dummy-3.2/config/locales/en.yml
|
326
|
+
- spec/dummy-3.2/config/routes.rb
|
327
|
+
- spec/dummy-3.2/db/seeds.rb
|
328
|
+
- spec/dummy-3.2/doc/README_FOR_APP
|
329
|
+
- spec/dummy-3.2/lib/assets/.gitkeep
|
330
|
+
- spec/dummy-3.2/lib/tasks/.gitkeep
|
331
|
+
- spec/dummy-3.2/log/.gitkeep
|
332
|
+
- spec/dummy-3.2/public/404.html
|
333
|
+
- spec/dummy-3.2/public/422.html
|
334
|
+
- spec/dummy-3.2/public/500.html
|
335
|
+
- spec/dummy-3.2/public/favicon.ico
|
336
|
+
- spec/dummy-3.2/public/index.html
|
337
|
+
- spec/dummy-3.2/public/robots.txt
|
338
|
+
- spec/dummy-3.2/script/rails
|
339
|
+
- spec/dummy-3.2/test/fixtures/.gitkeep
|
340
|
+
- spec/dummy-3.2/test/functional/.gitkeep
|
341
|
+
- spec/dummy-3.2/test/integration/.gitkeep
|
342
|
+
- spec/dummy-3.2/test/performance/browsing_test.rb
|
343
|
+
- spec/dummy-3.2/test/test_helper.rb
|
344
|
+
- spec/dummy-3.2/test/unit/.gitkeep
|
345
|
+
- spec/dummy-3.2/vendor/assets/javascripts/.gitkeep
|
346
|
+
- spec/dummy-3.2/vendor/assets/stylesheets/.gitkeep
|
347
|
+
- spec/dummy-3.2/vendor/plugins/.gitkeep
|
243
348
|
- spec/dummy/README.rdoc
|
244
349
|
- spec/dummy/Rakefile
|
245
350
|
- spec/dummy/app/assets/images/.keep
|
@@ -264,7 +369,6 @@ test_files:
|
|
264
369
|
- spec/dummy/config/environments/production.rb
|
265
370
|
- spec/dummy/config/environments/test.rb
|
266
371
|
- spec/dummy/config/environments/test_with_specific_position.rb
|
267
|
-
- spec/dummy/config/environments/test_without_buchestache.rb
|
268
372
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
269
373
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
270
374
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
@@ -286,4 +390,3 @@ test_files:
|
|
286
390
|
- spec/peastash/rails_ext/watch_spec.rb
|
287
391
|
- spec/peastash_spec.rb
|
288
392
|
- spec/spec_helper.rb
|
289
|
-
has_rdoc:
|