Commit e0298c2e733b1164742fe47bf6ebb007b1ccf214
1 parent
7729506e
Exists in
master
and in
22 other branches
plugins: use foo plugin on cucumber tests
Showing
2 changed files
with
22 additions
and
21 deletions
Show diff stats
features/plugins.feature
| ... | ... | @@ -13,46 +13,39 @@ Feature: plugins |
| 13 | 13 | | login | name | |
| 14 | 14 | | joaosilva | Joao Silva | |
| 15 | 15 | And I am logged in as "joaosilva" |
| 16 | - And the following plugin | |
| 17 | - | klass | | |
| 18 | - | TestPlugin | | |
| 19 | - And the following events of TestPlugin | |
| 20 | - | event | body | | |
| 21 | - | control_panel_buttons | proc { {:title => 'Test plugin button', :icon => '', :url => ''} } | | |
| 22 | - | profile_tabs | proc { {:title => 'Test plugin tab', :id => 'test_plugin', :content => proc {'Test plugin random content'} } } | | |
| 23 | 16 | |
| 24 | 17 | Scenario: a user must see the plugin\'s button in the control panel if the plugin is enabled |
| 25 | - Given plugin Test is enabled on environment | |
| 18 | + Given plugin Foo is enabled on environment | |
| 26 | 19 | And I go to joaosilva's control panel |
| 27 | - Then I should see "Test plugin button" | |
| 20 | + Then I should see "Foo plugin button" | |
| 28 | 21 | |
| 29 | 22 | Scenario: a user must see the plugin\'s tab in in the profile if the plugin is enabled |
| 30 | - Given plugin Test is enabled on environment | |
| 23 | + Given plugin Foo is enabled on environment | |
| 31 | 24 | And I am on joaosilva's profile |
| 32 | - Then I should see "Test plugin tab" | |
| 25 | + Then I should see "Foo plugin tab" | |
| 33 | 26 | |
| 34 | 27 | Scenario: a user must not see the plugin\'s button in the control panel if the plugin is disabled |
| 35 | - Given plugin Test is disabled on environment | |
| 28 | + Given plugin Foo is disabled on environment | |
| 36 | 29 | And I go to joaosilva's control panel |
| 37 | - Then I should not see "Test plugin button" | |
| 30 | + Then I should not see "Foo plugin button" | |
| 38 | 31 | |
| 39 | 32 | Scenario: a user must not see the plugin\'s tab in in the profile if the plugin is disabled |
| 40 | - Given plugin Test is disabled on environment | |
| 33 | + Given plugin Foo is disabled on environment | |
| 41 | 34 | And I am on joaosilva's profile |
| 42 | - Then I should not see "Test plugin tab" | |
| 35 | + Then I should not see "Foo plugin tab" | |
| 43 | 36 | |
| 44 | 37 | Scenario: an admin should be able to deactivate a plugin |
| 45 | - Given plugin Test is enabled on environment | |
| 38 | + Given plugin Foo is enabled on environment | |
| 46 | 39 | And I am logged in as admin |
| 47 | 40 | When I go to admin_user's control panel |
| 48 | - Then I should see "Test plugin button" | |
| 41 | + Then I should see "Foo plugin button" | |
| 49 | 42 | When I go to admin_user's profile |
| 50 | - Then I should see "Test plugin tab" | |
| 43 | + Then I should see "Foo plugin tab" | |
| 51 | 44 | And I go to the environment control panel |
| 52 | 45 | And I follow "Plugins" |
| 53 | - And I uncheck "Test plugin" | |
| 46 | + And I uncheck "Foo" | |
| 54 | 47 | And I press "Save changes" |
| 55 | 48 | When I go to admin_user's control panel |
| 56 | - Then I should not see "Test plugin button" | |
| 49 | + Then I should not see "Foo plugin button" | |
| 57 | 50 | When I go to admin_user's profile |
| 58 | - Then I should not see "Test plugin tab" | |
| 51 | + Then I should not see "Foo plugin tab" | ... | ... |
plugins/foo/lib/foo_plugin.rb
| ... | ... | @@ -8,4 +8,12 @@ class FooPlugin < Noosfero::Plugin |
| 8 | 8 | _("A sample plugin to test autoload craziness.") |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | + def control_panel_buttons | |
| 12 | + {:title => 'Foo plugin button', :icon => '', :url => ''} | |
| 13 | + end | |
| 14 | + | |
| 15 | + def profile_tabs | |
| 16 | + {:title => 'Foo plugin tab', :id => 'foo_plugin', :content => lambda {'Foo plugin random content'} } | |
| 17 | + end | |
| 18 | + | |
| 11 | 19 | end | ... | ... |