context "N+1", :n_plus_one do
it "n+1" do
audit_type_2 = create(:audit_type, account: org)
audit_type_3 = create(:audit_type, account: org)
audit_type_4 = create(:audit_type, account: another_org)
expect { do_request(:get, "/api/v3/project_types?org_id=#{org.organization_id}", org_user) }.to perform_constant_number_of_queries
end
end
command running test
bundle exec rspec spec/controllers/api/v3/audit_types_controller_spec.rb:338
Failure/Error: expect { do_request(:get, "/api/v3/project_types?org_id=#{org.organization_id}", org_user) }.to perform_constant_number_of_queries
Expected to make the same number of queries, but got:
194 for N=2
195 for N=3
Unmatched query numbers by tables:
# ./spec/controllers/api/v3/audit_types_controller_spec.rb:345:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:83:in
If I try to run test with filter, tests result returns success, but should return failure:
Could you please show the output when running with the only NPLUSONE_VERBOSE=1 env var? (w/o filtering) I wonder, which queries have been collected (and why we filtered them all out).
What did you do?
I have a following scenario
command running test
If I try to run test with filter, tests result returns success, but should return failure:
NPLUSONE_VERBOSE=1 NPLUSONE_FILTER=accounts bundle exec rspec spec/controllers/api/v3/audit_types_controller_spec.rb:338
What did you expect to happen?
Unmatched query numbers by tables: accounts (SELECT)