Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/solid_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions test/mailers/solid_errors/error_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading