correct flaky spec

This commit is contained in:
Sam 2018-03-27 17:57:19 +11:00
parent 6c70925c6f
commit 31dea5d5fc
1 changed files with 5 additions and 1 deletions

View File

@ -235,7 +235,7 @@ describe Middleware::RequestTracker do
def app(result, sql_calls: 0, redis_calls: 0)
lambda do |env|
sql_calls.times do
User.where(id: -100).first
User.where(id: -100).pluck(:id)
end
redis_calls.times do
$redis.get("x")
@ -260,6 +260,10 @@ describe Middleware::RequestTracker do
end
it "can correctly log detailed data" do
# ensure pg is warmed up with the select 1 query
User.where(id: -100).pluck(:id)
tracker = Middleware::RequestTracker.new(app([200, {}, []], sql_calls: 2, redis_calls: 2))
tracker.call(env)