Merge pull request #2887 from wairbut-m2c/backport/db_queries

[Backport] Replace `.all.each` with `.find_each` to reduce memory usage
This commit is contained in:
Raimond Garcia
2018-09-17 19:06:46 +02:00
committed by GitHub
11 changed files with 18 additions and 18 deletions

View File

@@ -199,7 +199,7 @@ feature "Admin Notifications" do
expect(page).to have_content "Notification sent successfully"
User.all.each do |user|
User.find_each do |user|
expect(user.notifications.count).to eq(1)
end
end

View File

@@ -41,7 +41,7 @@ feature "Admin newsletter emails" do
expect(page).to have_css(".newsletter", count: 3)
Newsletter.all.each do |newsletter|
Newsletter.find_each do |newsletter|
segment_recipient = I18n.t("admin.segment_recipient.#{newsletter.segment_recipient}")
within("#newsletter_#{newsletter.id}") do
expect(page).to have_content newsletter.subject

View File

@@ -15,7 +15,7 @@ feature 'Signature sheets' do
expect(page).to have_css(".signature_sheet", count: 3)
SignatureSheet.all.each do |signature_sheet|
SignatureSheet.find_each do |signature_sheet|
expect(page).to have_content signature_sheet.name
end
end

View File

@@ -131,7 +131,7 @@ feature 'Stats' do
expect(page).to have_css(".proposal_notification", count: 3)
ProposalNotification.all.each do |proposal_notification|
ProposalNotification.find_each do |proposal_notification|
expect(page).to have_content proposal_notification.title
expect(page).to have_content proposal_notification.body
end