Commit d537f28a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '10io-update-query-recorder-documentation' into 'master'

Update the examples in the query recorder docs

See merge request gitlab-org/gitlab!70184
parents 266f981f 75c461ce
......@@ -18,9 +18,9 @@ This style of test works by counting the number of SQL queries executed by Activ
```ruby
it "avoids N+1 database queries" do
control_count = ActiveRecord::QueryRecorder.new { visit_some_page }.count
control = ActiveRecord::QueryRecorder.new { visit_some_page }
create_list(:issue, 5)
expect { visit_some_page }.not_to exceed_query_limit(control_count)
expect { visit_some_page }.not_to exceed_query_limit(control)
end
```
......@@ -37,9 +37,9 @@ You should pass the `skip_cached` variable to `QueryRecorder` and use the `excee
```ruby
it "avoids N+1 database queries", :use_sql_query_cache do
control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) { visit_some_page }.count
control = ActiveRecord::QueryRecorder.new(skip_cached: false) { visit_some_page }
create_list(:issue, 5)
expect { visit_some_page }.not_to exceed_all_query_limit(control_count)
expect { visit_some_page }.not_to exceed_all_query_limit(control)
end
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment