diff --git a/features/plugins.feature b/features/plugins.feature index 0adb78c..572c9de 100644 --- a/features/plugins.feature +++ b/features/plugins.feature @@ -13,46 +13,39 @@ Feature: plugins | login | name | | joaosilva | Joao Silva | And I am logged in as "joaosilva" - And the following plugin - | klass | - | TestPlugin | - And the following events of TestPlugin - | event | body | - | control_panel_buttons | proc { {:title => 'Test plugin button', :icon => '', :url => ''} } | - | profile_tabs | proc { {:title => 'Test plugin tab', :id => 'test_plugin', :content => proc {'Test plugin random content'} } } | Scenario: a user must see the plugin\'s button in the control panel if the plugin is enabled - Given plugin Test is enabled on environment + Given plugin Foo is enabled on environment And I go to joaosilva's control panel - Then I should see "Test plugin button" + Then I should see "Foo plugin button" Scenario: a user must see the plugin\'s tab in in the profile if the plugin is enabled - Given plugin Test is enabled on environment + Given plugin Foo is enabled on environment And I am on joaosilva's profile - Then I should see "Test plugin tab" + Then I should see "Foo plugin tab" Scenario: a user must not see the plugin\'s button in the control panel if the plugin is disabled - Given plugin Test is disabled on environment + Given plugin Foo is disabled on environment And I go to joaosilva's control panel - Then I should not see "Test plugin button" + Then I should not see "Foo plugin button" Scenario: a user must not see the plugin\'s tab in in the profile if the plugin is disabled - Given plugin Test is disabled on environment + Given plugin Foo is disabled on environment And I am on joaosilva's profile - Then I should not see "Test plugin tab" + Then I should not see "Foo plugin tab" Scenario: an admin should be able to deactivate a plugin - Given plugin Test is enabled on environment + Given plugin Foo is enabled on environment And I am logged in as admin When I go to admin_user's control panel - Then I should see "Test plugin button" + Then I should see "Foo plugin button" When I go to admin_user's profile - Then I should see "Test plugin tab" + Then I should see "Foo plugin tab" And I go to the environment control panel And I follow "Plugins" - And I uncheck "Test plugin" + And I uncheck "Foo" And I press "Save changes" When I go to admin_user's control panel - Then I should not see "Test plugin button" + Then I should not see "Foo plugin button" When I go to admin_user's profile - Then I should not see "Test plugin tab" + Then I should not see "Foo plugin tab" diff --git a/plugins/foo/lib/foo_plugin.rb b/plugins/foo/lib/foo_plugin.rb index b74f6f7..ed1340c 100644 --- a/plugins/foo/lib/foo_plugin.rb +++ b/plugins/foo/lib/foo_plugin.rb @@ -8,4 +8,12 @@ class FooPlugin < Noosfero::Plugin _("A sample plugin to test autoload craziness.") end + def control_panel_buttons + {:title => 'Foo plugin button', :icon => '', :url => ''} + end + + def profile_tabs + {:title => 'Foo plugin tab', :id => 'foo_plugin', :content => lambda {'Foo plugin random content'} } + end + end -- libgit2 0.21.2