DEV: Fix another report flaky (#28868)

Followup 0323b366f3

This was happening because another spec was adding a
report using the plugin API, but there was nothing
resetting that, so later in the reports controller
when we did Report.singleton_methods, we ended up
with another report with no translation, causing another
error.
This commit is contained in:
Martin Brennan 2024-09-12 10:34:38 +10:00 committed by GitHub
parent bca82e9dec
commit 78268ca767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -224,6 +224,11 @@ class Report
singleton_class.instance_eval { define_method("report_#{name}", &block) }
end
# Only used for testing.
def Report.remove_report(name)
singleton_class.instance_eval { remove_method("report_#{name}") }
end
def self._get(type, opts = nil)
opts ||= {}

View File

@ -358,6 +358,8 @@ TEXT
end
describe "#add_report" do
after { Report.remove_report("readers") }
it "adds a report" do
plugin = Plugin::Instance.new nil, "/tmp/test.rb"
plugin.add_report("readers") {}