summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/omniauth/Gemfile2
-rw-r--r--spec/integration/omniauth/Rakefile29
2 files changed, 31 insertions, 0 deletions
diff --git a/spec/integration/omniauth/Gemfile b/spec/integration/omniauth/Gemfile
index cbb4b87..4221e7f 100644
--- a/spec/integration/omniauth/Gemfile
+++ b/spec/integration/omniauth/Gemfile
@@ -1,7 +1,9 @@
source 'http://rubygems.org'
+gem 'benchmark-ips'
gem 'hashie', path: '../../..'
gem 'omniauth', '~> 1.4.1'
gem 'sinatra'
+gem 'rake'
gem 'rspec', '~> 3.5.0'
gem 'rack-test', '~> 0.6.3'
diff --git a/spec/integration/omniauth/Rakefile b/spec/integration/omniauth/Rakefile
new file mode 100644
index 0000000..4e0c11f
--- /dev/null
+++ b/spec/integration/omniauth/Rakefile
@@ -0,0 +1,29 @@
+namespace :perf do
+ task :setup do
+ require 'omniauth'
+ require 'rack/test'
+ app = Rack::Builder.new do |b|
+ b.use Rack::Session::Cookie, secret: 'abc123'
+ b.use OmniAuth::Strategies::Developer
+ b.run ->(_env) { [200, {}, ['Not Found']] }
+ end.to_app
+ @app = Rack::MockRequest.new(app)
+
+ def call_app(path = ENV['GET_PATH'] || '/')
+ result = @app.get(path)
+ fail "Did not succeed #{result.body}" unless result.status == 200
+ result
+ end
+ end
+
+ task ips: :setup do
+ require 'benchmark/ips'
+ Benchmark.ips do |x|
+ x.hold!('../../../tmp/omniauth_benchmark.json')
+ x.report('before') { call_app }
+ x.report('after') { call_app }
+
+ x.compare!
+ end
+ end
+end