RSpec and Minitest matchers to prevent N 1 queries problem
10-Sep-2020 1997
Unlike other libraries (such as db-query-matchers, rspec-sqlimit, etc), with n_plus_one_control you don't have to specify exact expectations to control your code behaviour (e.g. expect { subject }.to query(2).times).Such expectations are rather hard to maintain, 'cause there is a big chance of adding more queries, not related to the system under test.NPlusOneControl works differently. It evaluates the code under consideration several times with different scale factors to make sure that the number of DB queries behaves as expected (i.e. O(1) instead of O(N)).So, it's for performance testing and not feature testing.
RSpec and Minitest matchers to prevent N 1 queries problem #ruby #rubydeveloper #rubyonrails #RSpec #Minitest #matchers #prevent #queries #problem #minitest #rspec https://rubyonrails.ba/link/rspec-and-minitest-matchers-to-prevent-n-1-queries-problem