diff --git a/lib/solid_errors.rb b/lib/solid_errors.rb index 7e9b4ff..d42da4a 100644 --- a/lib/solid_errors.rb +++ b/lib/solid_errors.rb @@ -47,11 +47,11 @@ def without_emails end def url_helper_name - @url_helper_name ||= detect_url_helper_name + @@url_helper_name ||= detect_url_helper_name end def url_options - @url_options ||= detect_url_options + @@url_options ||= detect_url_options end private diff --git a/test/mailers/solid_errors/error_mailer_test.rb b/test/mailers/solid_errors/error_mailer_test.rb index 13a5c51..25fdeb5 100644 --- a/test/mailers/solid_errors/error_mailer_test.rb +++ b/test/mailers/solid_errors/error_mailer_test.rb @@ -36,6 +36,19 @@ def deliver!(_mail) ActionMailer::Base.default_url_options = {} end + test "the error email links with configured url options" do + report_raised_error("oof") + occurrence = SolidErrors::Occurrence.last + SolidErrors.url_options = {host: "admin.example.com", protocol: "https"} + + email = SolidErrors::ErrorMailer.error_occurred(occurrence) + + url = "https://admin.example.com/solid_errors/#{occurrence.error_id}#occurrence_#{occurrence.id}" + assert_includes email.html_part.body.to_s, %(href="#{url}") + ensure + SolidErrors.url_options = nil + end + test "a failed delivery is recorded without sending another email" do with_failing_delivery do report_raised_error("oof")