Project

General

Profile

« Previous | Next » 

Revision d3f47405

Added by Dominic Cleal about 7 years ago

fixes #19464 - rewrite Dashboard::Manager to support autoloading

Replaces class-level widget storage with a static list of built-in
widgets, then appends the registered plugin widgets to get the full
default list of widgets. As a result, the class can safely be reloaded
when modified and is more testable as class-level state is removed.

View differences:

test/unit/plugin_test.rb
end
end
def test_add_dashboard_widget
widget_params = {template: 'plugin_widget', name: 'Plugin Widget', sizex: 2, sizey: 2}
plugin = Foreman::Plugin.register :test_widget do
widget 'plugin_widget', widget_params.except(:template)
end
assert_equal [widget_params], plugin.dashboard_widgets
assert_includes Dashboard::Manager.default_widgets, widget_params
end
context "adding permissions" do
teardown do
permission = Foreman::AccessControl.permission(:test_permission)

Also available in: Unified diff