Extract method to get a user segment name

We're going to add geozones as user segments, so it's handy to have the
method in the UserSegments class.

We're also changing the `user_segment_emails` parameter name for
consistency and simplicity.
This commit is contained in:
Javi Martín
2021-11-10 20:35:46 +01:00
parent a0416d4d85
commit 78e543f6d3
7 changed files with 36 additions and 18 deletions

View File

@@ -215,15 +215,15 @@ describe "Admin Notifications", :admin do
end
scenario "Select list of users to send notification" do
UserSegments.segments.each do |user_segment|
segment_recipient = I18n.t("admin.segment_recipient.#{user_segment}")
UserSegments.segments.each do |segment|
segment_recipient = UserSegments.segment_name(segment)
visit new_admin_admin_notification_path
fill_in_admin_notification_form(segment_recipient: segment_recipient)
click_button "Create notification"
expect(page).to have_content(I18n.t("admin.segment_recipient.#{user_segment}"))
expect(page).to have_content segment_recipient
end
end
end