Leave other plugins' features to hooks

Refund emails and PDFs take the shop name and mail settings from
:qbo_mail_settings instead of reading redmine_qbo_reminders' settings; the
customer page's ticked boxes use generic data-ticked-field/data-ticked-params
instead of knowing redmine_qbo_calendar's Add appointment link; and Create
issues carries the params plugins name in :qbo_billing_issue_carry_params
instead of appointment_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-21 07:37:57 -05:00
1 parent 0552e2f1a3
commit ae0ffc7c1c
10 files changed
+69 -39

No files matched your search

@@ -62,6 +62,13 @@ class CustomersControllerTest < Redmine::IntegrationTest
assert_redirected_to '/customers/9101'
end
def test_new_issue_picks_up_ticked_boxes
grant(:view_customers, :add_issues)
get '/customers/9101'
assert_select 'a#dynamic-new-issue-link[data-ticked-params=?]', 'issue[%s]'
assert_includes response.body, "a[data-ticked-params]"
end
def test_show_lists_open_and_closed_issues
grant(:view_customers)
get '/customers/9101'
+17
View File
@@ -103,6 +103,23 @@ class QboHelpersTest < ActiveSupport::TestCase
end
end
def test_refund_email_with_another_plugins_mail_settings
RedmineQboBilling.stubs(:mail_settings).returns(shop_name: 'Example Garage', from: 'Example Garage <shop@example.com>',
reply_to: 'office@example.com')
mail = QboRefundMailer.refund_summary(refund, 'jane@example.com')
assert_equal ['shop@example.com'], mail.from
assert_equal ['office@example.com'], mail.reply_to
assert_match 'Example Garage', mail.subject
end
def test_mail_settings_from_plugins
Redmine::Hook.stubs(:call_hook).with(:qbo_mail_settings, {})
.returns([{ shop_name: '', from: 'a@example.com' }, nil, { 'shop_name' => 'Example Garage' }])
assert_equal({ from: 'a@example.com', shop_name: 'Example Garage' }, RedmineQboBilling.mail_settings)
Redmine::Hook.stubs(:call_hook).with(:qbo_mail_settings, {}).raises(StandardError, 'boom')
assert_equal({}, RedmineQboBilling.mail_settings)
end
def test_refund_email_when_delivery_is_off
ActionMailer::Base.stubs(:perform_deliveries).returns(false)
assert_raises(QboRefundMailer::DeliveryOff) { QboRefundMailer.refund_summary(refund, 'jane@example.com').message }