diff --git a/app/models/report.rb b/app/models/report.rb index 970b47c68de..03765b52b98 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -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 ||= {} diff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rb index 12179700de2..f294cb285bc 100644 --- a/spec/lib/plugin/instance_spec.rb +++ b/spec/lib/plugin/instance_spec.rb @@ -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") {}