mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 02:52:49 +01:00
Run benchmark specs optionally
This commit is contained in:
parent
9b6a9082b3
commit
84135eac5b
@ -2,34 +2,36 @@ require_relative 'helper'
|
|||||||
require 'rack/test'
|
require 'rack/test'
|
||||||
require 'app'
|
require 'app'
|
||||||
|
|
||||||
describe 'benchmark the app' do
|
if ENV['BENCH']
|
||||||
include Rack::Test::Methods
|
describe 'benchmark the app' do
|
||||||
|
include Rack::Test::Methods
|
||||||
|
|
||||||
let(:app) { Sinatra::Application }
|
let(:app) { Sinatra::Application }
|
||||||
|
|
||||||
bench_performance_constant 'latest' do
|
bench_performance_constant 'latest' do
|
||||||
100.times do
|
100.times do
|
||||||
get '/latest'
|
get '/latest'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
bench_performance_constant 'latest base' do
|
bench_performance_constant 'latest base' do
|
||||||
100.times do
|
100.times do
|
||||||
get '/latest?base=USD'
|
get '/latest?base=USD'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
bench_performance_constant 'historical' do
|
bench_performance_constant 'historical' do
|
||||||
100.times do
|
100.times do
|
||||||
random_date = Date.today - rand(4000)
|
random_date = Date.today - rand(4000)
|
||||||
get "/#{random_date}"
|
get "/#{random_date}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
bench_performance_constant 'historical base' do
|
bench_performance_constant 'historical base' do
|
||||||
100.times do
|
100.times do
|
||||||
random_date = Date.today - rand(4000)
|
random_date = Date.today - rand(4000)
|
||||||
get "/#{random_date}?base=USD"
|
get "/#{random_date}?base=USD"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
require 'minitest/autorun'
|
require 'minitest/autorun'
|
||||||
require 'minitest/benchmark'
|
require 'minitest/benchmark' if ENV['BENCH']
|
||||||
require 'minitest/pride'
|
require 'minitest/pride'
|
||||||
|
Loading…
Reference in New Issue
Block a user