mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
FEATURE: adds a add_report method accessible in plugin.rb
This commit is contained in:
parent
7eff64773c
commit
24c27b5321
@ -92,6 +92,14 @@ class Plugin::Instance
|
|||||||
end
|
end
|
||||||
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
|
def replace_flags
|
||||||
settings = ::FlagSettings.new
|
settings = ::FlagSettings.new
|
||||||
yield settings
|
yield settings
|
||||||
|
@ -116,6 +116,15 @@ describe Plugin::Instance do
|
|||||||
end
|
end
|
||||||
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
|
context "activate!" do
|
||||||
it "can activate plugins correctly" do
|
it "can activate plugins correctly" do
|
||||||
plugin = Plugin::Instance.new
|
plugin = Plugin::Instance.new
|
||||||
|
Loading…
x
Reference in New Issue
Block a user