2019-01-08 00:20:31 +02:00
|
|
|
require "rails_helper"
|
|
|
|
|
2019-04-28 21:10:54 +03:00
|
|
|
feature "Volunteering" do
|
2024-04-18 21:11:08 +03:00
|
|
|
include ActiveJob::TestHelper
|
|
|
|
|
2019-01-08 00:20:31 +02:00
|
|
|
before do
|
|
|
|
Rails.application.load_seed
|
|
|
|
sign_in_as_admin
|
|
|
|
create_new_conference
|
|
|
|
sign_out
|
|
|
|
end
|
|
|
|
|
2019-04-28 21:10:54 +03:00
|
|
|
scenario "A user applies to be a volunteer for the upcoming conference" do
|
2019-01-08 00:20:31 +02:00
|
|
|
visit root_path
|
2019-04-28 21:10:54 +03:00
|
|
|
click_on I18n.t("views.volunteers.apply")
|
2019-01-08 00:20:31 +02:00
|
|
|
|
2024-04-18 21:11:08 +03:00
|
|
|
perform_enqueued_jobs do
|
|
|
|
fill_in_volunteer_profile
|
|
|
|
expect(page).to have_content I18n.t("views.volunteers.successful_application")
|
|
|
|
expect(page).to have_content I18n.t("views.volunteers.email_not_confirmed")
|
|
|
|
end
|
|
|
|
|
|
|
|
perform_enqueued_jobs do
|
|
|
|
visit link_from_last_email
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).not_to have_content I18n.t("views.volunteers.email_not_confirmed")
|
|
|
|
|
|
|
|
expect(ActionMailer::Base.deliveries.last.subject).to eq(I18n.t("volunteer_mailer.success_notification.subject", conference_name: "FooConf #{1.year.from_now.year}"))
|
2019-01-08 18:16:32 +02:00
|
|
|
|
|
|
|
sign_in_as_admin
|
|
|
|
click_on_first_conference_in_management_root
|
2019-04-28 21:10:54 +03:00
|
|
|
click_on I18n.t("activerecord.models.volunteership", count: 2).capitalize
|
|
|
|
expect(page).to have_content "Volunteer Foo"
|
2019-01-08 00:20:31 +02:00
|
|
|
end
|
2024-04-18 21:11:08 +03:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def link_from_last_email
|
|
|
|
ActionMailer::Base.deliveries.last.body.to_s.strip[%r{(?<=https://www\.example\.com).*?(?=$)}]
|
|
|
|
end
|
2019-01-08 00:20:31 +02:00
|
|
|
end
|