* Do not load messages in memory, just to count them * Add Model.estimated_count * Use Model.estimated_count in task record_db_table_counts * Use size and estimated_count * Use table_name so that .estimated_count works with all models * Add comment to explain the .load.size + .each pattern
10 lines
317 B
Ruby
10 lines
317 B
Ruby
require "rails_helper"
|
|
|
|
# ApplicationRecord is an abstract class, tests will use one of the core models
|
|
RSpec.describe ApplicationRecord, type: :model do
|
|
describe ".estimated_count" do
|
|
it "does not raise errors if there are no rows" do
|
|
expect { User.estimated_count }.not_to raise_error
|
|
end
|
|
end
|
|
end
|