Commit 75c461ce authored by David Fernandez's avatar David Fernandez

Update the examples in the query recorder docs

parent 98a4386b
......@@ -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