Reduce number of requests in user segments tests

We were testing the creation of newsletters and admin notifications for
each existing segment, which IMHO is a bit overkill, considering how
slow system tests are.

So far we don't have any reasons to believe creating newsletters and
admin notifications will only work for some user segments, so we're
testing a random one instead.

Running these tests on my machine is now about 15 seconds faster.
This commit is contained in:
Javi Martín
2021-11-10 21:05:22 +01:00
parent 25a8950330
commit 18910d0904
2 changed files with 12 additions and 14 deletions

View File

@@ -215,7 +215,7 @@ describe "Admin Notifications", :admin do
end
scenario "Select list of users to send notification" do
UserSegments.segments.each do |segment|
segment = UserSegments.segments.sample
segment_recipient = UserSegments.segment_name(segment)
visit new_admin_admin_notification_path
@@ -225,5 +225,4 @@ describe "Admin Notifications", :admin do
expect(page).to have_content segment_recipient
end
end
end

View File

@@ -162,7 +162,7 @@ describe "Admin newsletter emails", :admin do
describe "Select list of users to send newsletter" do
scenario "Custom user segments" do
UserSegments.segments.each do |segment|
segment = UserSegments.segments.sample
segment_recipient = UserSegments.segment_name(segment)
visit new_admin_newsletter_path
@@ -172,7 +172,6 @@ describe "Admin newsletter emails", :admin do
expect(page).to have_content segment_recipient
end
end
scenario "Geozone segments" do
create(:geozone, name: "Queens and Brooklyn")