FEATURE: adds a add_report method accessible in plugin.rb

This commit is contained in:
Joffrey JAFFEUX 2018-06-19 15:00:11 +02:00 committed by GitHub
parent 7eff64773c
commit 24c27b5321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -92,6 +92,14 @@ class Plugin::Instance
end
end
def add_report(name, &block)
reloadable_patch do |plugin|
if plugin.enabled?
Report.add_report(name, &block)
end
end
end
def replace_flags
settings = ::FlagSettings.new
yield settings

View File

@ -116,6 +116,15 @@ describe Plugin::Instance do
end
end
context "#add_report" do
it "adds a report" do
plugin = Plugin::Instance.new nil, "/tmp/test.rb"
plugin.add_report("readers") {}
expect(Report.respond_to?(:report_readers)).to eq(true)
end
end
context "activate!" do
it "can activate plugins correctly" do
plugin = Plugin::Instance.new