Commit 439e134fb12d9479043910ed6db9a6eecc1d0fc6
Exists in
master
and in
22 other branches
Merge branch 'rails235' into AI2983-pg_search_escape_chars_fix
Showing
22 changed files
with
78 additions
and
23 deletions
Show diff stats
lib/noosfero/plugin.rb
| @@ -16,14 +16,7 @@ class Noosfero::Plugin | @@ -16,14 +16,7 @@ class Noosfero::Plugin | ||
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | def init_system | 18 | def init_system |
| 19 | - enabled_plugins = Dir.glob(File.join(Rails.root, 'config', 'plugins', '*')) | ||
| 20 | - if Rails.env.test? && !enabled_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo')) | ||
| 21 | - enabled_plugins << File.join(Rails.root, 'plugins', 'foo') | ||
| 22 | - end | ||
| 23 | - | ||
| 24 | - enabled_plugins.select do |entry| | ||
| 25 | - File.directory?(entry) | ||
| 26 | - end.each do |dir| | 19 | + available_plugins.each do |dir| |
| 27 | load_plugin dir | 20 | load_plugin dir |
| 28 | end | 21 | end |
| 29 | end | 22 | end |
| @@ -76,12 +69,19 @@ class Noosfero::Plugin | @@ -76,12 +69,19 @@ class Noosfero::Plugin | ||
| 76 | klass(plugin_name) | 69 | klass(plugin_name) |
| 77 | end | 70 | end |
| 78 | 71 | ||
| 79 | - def all | ||
| 80 | - @all ||= [] | 72 | + def available_plugins |
| 73 | + unless @available_plugins | ||
| 74 | + path = File.join(Rails.root, 'config', 'plugins', '*') | ||
| 75 | + @available_plugins = Dir.glob(path).select{ |i| File.directory?(i) } | ||
| 76 | + if Rails.env.test? && !@available_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo')) | ||
| 77 | + @available_plugins << File.join(Rails.root, 'plugins', 'foo') | ||
| 78 | + end | ||
| 79 | + end | ||
| 80 | + @available_plugins | ||
| 81 | end | 81 | end |
| 82 | 82 | ||
| 83 | - def inherited(subclass) | ||
| 84 | - all << subclass.to_s unless all.include?(subclass.to_s) | 83 | + def all |
| 84 | + @all ||= available_plugins.map{ |dir| (File.basename(dir) + "_plugin").camelize } | ||
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | def public_name | 87 | def public_name |
test/functional/account_controller_test.rb
| @@ -689,6 +689,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -689,6 +689,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 689 | {:test => 5} | 689 | {:test => 5} |
| 690 | end | 690 | end |
| 691 | end | 691 | end |
| 692 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 692 | 693 | ||
| 693 | e = User.find_by_login('ze').environment | 694 | e = User.find_by_login('ze').environment |
| 694 | e.enable_plugin(Plugin1.name) | 695 | e.enable_plugin(Plugin1.name) |
| @@ -779,6 +780,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -779,6 +780,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 779 | lambda {"<strong>Plugin2 text</strong>"} | 780 | lambda {"<strong>Plugin2 text</strong>"} |
| 780 | end | 781 | end |
| 781 | end | 782 | end |
| 783 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 782 | 784 | ||
| 783 | Environment.default.enable_plugin(Plugin1.name) | 785 | Environment.default.enable_plugin(Plugin1.name) |
| 784 | Environment.default.enable_plugin(Plugin2.name) | 786 | Environment.default.enable_plugin(Plugin2.name) |
| @@ -795,6 +797,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -795,6 +797,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 795 | User.new(:login => 'testuser') | 797 | User.new(:login => 'testuser') |
| 796 | end | 798 | end |
| 797 | end | 799 | end |
| 800 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name]) | ||
| 798 | Environment.default.enable_plugin(Plugin1.name) | 801 | Environment.default.enable_plugin(Plugin1.name) |
| 799 | 802 | ||
| 800 | post :login, :user => {:login => "testuser"} | 803 | post :login, :user => {:login => "testuser"} |
| @@ -809,6 +812,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -809,6 +812,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 809 | nil | 812 | nil |
| 810 | end | 813 | end |
| 811 | end | 814 | end |
| 815 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name]) | ||
| 812 | Environment.default.enable_plugin(Plugin1.name) | 816 | Environment.default.enable_plugin(Plugin1.name) |
| 813 | post :login, :user => {:login => 'johndoe', :password => 'test'} | 817 | post :login, :user => {:login => 'johndoe', :password => 'test'} |
| 814 | assert session[:user] | 818 | assert session[:user] |
| @@ -822,6 +826,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -822,6 +826,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 822 | false | 826 | false |
| 823 | end | 827 | end |
| 824 | end | 828 | end |
| 829 | + Noosfero::Plugin.stubs(:all).returns([TestRegistrationPlugin.name]) | ||
| 825 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestRegistrationPlugin.new]) | 830 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestRegistrationPlugin.new]) |
| 826 | 831 | ||
| 827 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' } | 832 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' } |
| @@ -840,6 +845,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -840,6 +845,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 840 | true | 845 | true |
| 841 | end | 846 | end |
| 842 | end | 847 | end |
| 848 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 843 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) | 849 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) |
| 844 | 850 | ||
| 845 | get :login | 851 | get :login |
| @@ -853,6 +859,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -853,6 +859,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 853 | false | 859 | false |
| 854 | end | 860 | end |
| 855 | end | 861 | end |
| 862 | + Noosfero::Plugin.stubs(:all).returns([TestRegistrationPlugin.name]) | ||
| 856 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestRegistrationPlugin.new]) | 863 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestRegistrationPlugin.new]) |
| 857 | 864 | ||
| 858 | #Redirect on get action | 865 | #Redirect on get action |
| @@ -876,6 +883,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -876,6 +883,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 876 | true | 883 | true |
| 877 | end | 884 | end |
| 878 | end | 885 | end |
| 886 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.new, Plugin2.new]) | ||
| 879 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) | 887 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) |
| 880 | 888 | ||
| 881 | get :login | 889 | get :login |
| @@ -894,6 +902,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -894,6 +902,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 894 | lambda {"<strong>Plugin2 text</strong>"} | 902 | lambda {"<strong>Plugin2 text</strong>"} |
| 895 | end | 903 | end |
| 896 | end | 904 | end |
| 905 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 897 | 906 | ||
| 898 | Environment.default.enable_plugin(Plugin1.name) | 907 | Environment.default.enable_plugin(Plugin1.name) |
| 899 | Environment.default.enable_plugin(Plugin2.name) | 908 | Environment.default.enable_plugin(Plugin2.name) |
test/functional/application_controller_test.rb
| @@ -374,6 +374,8 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -374,6 +374,8 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 374 | end | 374 | end |
| 375 | plugin2_path = '/plugin2/style.css' | 375 | plugin2_path = '/plugin2/style.css' |
| 376 | 376 | ||
| 377 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 378 | + | ||
| 377 | environment = Environment.default | 379 | environment = Environment.default |
| 378 | environment.enable_plugin(Plugin1.name) | 380 | environment.enable_plugin(Plugin1.name) |
| 379 | environment.enable_plugin(Plugin2.name) | 381 | environment.enable_plugin(Plugin2.name) |
| @@ -405,6 +407,8 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -405,6 +407,8 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 405 | plugin2_path2 = '/plugin2/'+js2 | 407 | plugin2_path2 = '/plugin2/'+js2 |
| 406 | plugin2_path3 = '/plugin2/'+js3 | 408 | plugin2_path3 = '/plugin2/'+js3 |
| 407 | 409 | ||
| 410 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 411 | + | ||
| 408 | environment = Environment.default | 412 | environment = Environment.default |
| 409 | environment.enable_plugin(Plugin1.name) | 413 | environment.enable_plugin(Plugin1.name) |
| 410 | environment.enable_plugin(Plugin2.name) | 414 | environment.enable_plugin(Plugin2.name) |
| @@ -431,6 +435,8 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -431,6 +435,8 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 431 | end | 435 | end |
| 432 | end | 436 | end |
| 433 | 437 | ||
| 438 | + Noosfero::Plugin.stubs(:all).returns([TestBodyBeginning1Plugin.name, TestBodyBeginning2Plugin.name]) | ||
| 439 | + | ||
| 434 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestBodyBeginning1Plugin.new, TestBodyBeginning2Plugin.new]) | 440 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestBodyBeginning1Plugin.new, TestBodyBeginning2Plugin.new]) |
| 435 | 441 | ||
| 436 | get :index | 442 | get :index |
| @@ -455,6 +461,8 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -455,6 +461,8 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 455 | end | 461 | end |
| 456 | end | 462 | end |
| 457 | 463 | ||
| 464 | + Noosfero::Plugin.stubs(:all).returns([TestHeadEnding1Plugin.name, TestHeadEnding2Plugin.name]) | ||
| 465 | + | ||
| 458 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestHeadEnding1Plugin.new, TestHeadEnding2Plugin.new]) | 466 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestHeadEnding1Plugin.new, TestHeadEnding2Plugin.new]) |
| 459 | 467 | ||
| 460 | get :index | 468 | get :index |
| @@ -519,6 +527,7 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -519,6 +527,7 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 519 | :block => lambda {} } | 527 | :block => lambda {} } |
| 520 | end | 528 | end |
| 521 | end | 529 | end |
| 530 | + Noosfero::Plugin.stubs(:all).returns([FilterPlugin.name]) | ||
| 522 | 531 | ||
| 523 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([FilterPlugin.new]) | 532 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([FilterPlugin.new]) |
| 524 | 533 | ||
| @@ -537,6 +546,7 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -537,6 +546,7 @@ class ApplicationControllerTest < ActionController::TestCase | ||
| 537 | :block => lambda {'plugin block called'} } | 546 | :block => lambda {'plugin block called'} } |
| 538 | end | 547 | end |
| 539 | end | 548 | end |
| 549 | + Noosfero::Plugin.stubs(:all).returns([OtherFilterPlugin.name]) | ||
| 540 | 550 | ||
| 541 | environment1 = fast_create(Environment, :name => 'test environment') | 551 | environment1 = fast_create(Environment, :name => 'test environment') |
| 542 | environment1.enable_plugin(OtherFilterPlugin.name) | 552 | environment1.enable_plugin(OtherFilterPlugin.name) |
test/functional/catalog_controller_test.rb
| @@ -91,6 +91,7 @@ class CatalogControllerTest < ActionController::TestCase | @@ -91,6 +91,7 @@ class CatalogControllerTest < ActionController::TestCase | ||
| 91 | lambda {"<span id='plugin2'>This is Plugin2 speaking!</span>"} | 91 | lambda {"<span id='plugin2'>This is Plugin2 speaking!</span>"} |
| 92 | end | 92 | end |
| 93 | end | 93 | end |
| 94 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 94 | 95 | ||
| 95 | product = fast_create(Product, :profile_id => @enterprise.id) | 96 | product = fast_create(Product, :profile_id => @enterprise.id) |
| 96 | environment = Environment.default | 97 | environment = Environment.default |
test/functional/content_viewer_controller_test.rb
| @@ -1199,6 +1199,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1199,6 +1199,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 1199 | class Plugin2 < Noosfero::Plugin | 1199 | class Plugin2 < Noosfero::Plugin |
| 1200 | def content_remove_edit(content); false; end | 1200 | def content_remove_edit(content); false; end |
| 1201 | end | 1201 | end |
| 1202 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 1202 | 1203 | ||
| 1203 | environment.enable_plugin(Plugin1.name) | 1204 | environment.enable_plugin(Plugin1.name) |
| 1204 | environment.enable_plugin(Plugin2.name) | 1205 | environment.enable_plugin(Plugin2.name) |
| @@ -1215,6 +1216,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1215,6 +1216,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 1215 | class Plugin2 < Noosfero::Plugin | 1216 | class Plugin2 < Noosfero::Plugin |
| 1216 | def content_expire_edit(content); nil; end | 1217 | def content_expire_edit(content); nil; end |
| 1217 | end | 1218 | end |
| 1219 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 1218 | 1220 | ||
| 1219 | environment.enable_plugin(Plugin1.name) | 1221 | environment.enable_plugin(Plugin1.name) |
| 1220 | environment.enable_plugin(Plugin2.name) | 1222 | environment.enable_plugin(Plugin2.name) |
| @@ -1260,6 +1262,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1260,6 +1262,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 1260 | } | 1262 | } |
| 1261 | end | 1263 | end |
| 1262 | end | 1264 | end |
| 1265 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 1263 | 1266 | ||
| 1264 | Environment.default.enable_plugin(Plugin1.name) | 1267 | Environment.default.enable_plugin(Plugin1.name) |
| 1265 | Environment.default.enable_plugin(Plugin2.name) | 1268 | Environment.default.enable_plugin(Plugin2.name) |
| @@ -1284,6 +1287,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1284,6 +1287,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 1284 | scope.where(:referrer => 'kernel.org') | 1287 | scope.where(:referrer => 'kernel.org') |
| 1285 | end | 1288 | end |
| 1286 | end | 1289 | end |
| 1290 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 1287 | 1291 | ||
| 1288 | Environment.default.enable_plugin(Plugin1) | 1292 | Environment.default.enable_plugin(Plugin1) |
| 1289 | Environment.default.enable_plugin(Plugin2) | 1293 | Environment.default.enable_plugin(Plugin2) |
| @@ -1341,6 +1345,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1341,6 +1345,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 1341 | } | 1345 | } |
| 1342 | end | 1346 | end |
| 1343 | end | 1347 | end |
| 1348 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 1344 | 1349 | ||
| 1345 | Environment.default.enable_plugin(Plugin1.name) | 1350 | Environment.default.enable_plugin(Plugin1.name) |
| 1346 | Environment.default.enable_plugin(Plugin2.name) | 1351 | Environment.default.enable_plugin(Plugin2.name) |
test/functional/enterprise_registration_controller_test.rb
| @@ -193,6 +193,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | @@ -193,6 +193,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | ||
| 193 | {'plugin2' => 'Plugin 2'} | 193 | {'plugin2' => 'Plugin 2'} |
| 194 | end | 194 | end |
| 195 | end | 195 | end |
| 196 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 196 | 197 | ||
| 197 | environment = Environment.default | 198 | environment = Environment.default |
| 198 | environment.enable_plugin(Plugin1.name) | 199 | environment.enable_plugin(Plugin1.name) |
test/functional/friends_controller_test.rb
| @@ -68,6 +68,7 @@ class FriendsControllerTest < ActionController::TestCase | @@ -68,6 +68,7 @@ class FriendsControllerTest < ActionController::TestCase | ||
| 68 | false | 68 | false |
| 69 | end | 69 | end |
| 70 | end | 70 | end |
| 71 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 71 | 72 | ||
| 72 | e = profile.environment | 73 | e = profile.environment |
| 73 | e.enable_plugin(Plugin1.name) | 74 | e.enable_plugin(Plugin1.name) |
test/functional/home_controller_test.rb
| @@ -107,6 +107,7 @@ class HomeControllerTest < ActionController::TestCase | @@ -107,6 +107,7 @@ class HomeControllerTest < ActionController::TestCase | ||
| 107 | lambda {"<a href='plugin2'>Plugin2 link</a>"} | 107 | lambda {"<a href='plugin2'>Plugin2 link</a>"} |
| 108 | end | 108 | end |
| 109 | end | 109 | end |
| 110 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 110 | 111 | ||
| 111 | Environment.default.enable_plugin(Plugin1) | 112 | Environment.default.enable_plugin(Plugin1) |
| 112 | Environment.default.enable_plugin(Plugin2) | 113 | Environment.default.enable_plugin(Plugin2) |
| @@ -129,6 +130,7 @@ class HomeControllerTest < ActionController::TestCase | @@ -129,6 +130,7 @@ class HomeControllerTest < ActionController::TestCase | ||
| 129 | true | 130 | true |
| 130 | end | 131 | end |
| 131 | end | 132 | end |
| 133 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 132 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) | 134 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([Plugin1.new, Plugin2.new]) |
| 133 | 135 | ||
| 134 | get :index | 136 | get :index |
test/functional/memberships_controller_test.rb
| @@ -234,6 +234,7 @@ class MembershipsControllerTest < ActionController::TestCase | @@ -234,6 +234,7 @@ class MembershipsControllerTest < ActionController::TestCase | ||
| 234 | {'plugin2' => 'Plugin 2'} | 234 | {'plugin2' => 'Plugin 2'} |
| 235 | end | 235 | end |
| 236 | end | 236 | end |
| 237 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
| 237 | 238 | ||
| 238 | environment = Environment.default | 239 | environment = Environment.default |
| 239 | environment.enable_plugin(Plugin1.name) | 240 | environment.enable_plugin(Plugin1.name) |
test/functional/plugins_controller_test.rb
| @@ -47,7 +47,7 @@ class PluginsControllerTest < ActionController::TestCase | @@ -47,7 +47,7 @@ class PluginsControllerTest < ActionController::TestCase | ||
| 47 | end | 47 | end |
| 48 | end | 48 | end |
| 49 | 49 | ||
| 50 | - Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s,Plugin2.to_s]) | 50 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) |
| 51 | 51 | ||
| 52 | get :index | 52 | get :index |
| 53 | 53 |
test/functional/profile_controller_test.rb
| @@ -1255,6 +1255,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1255,6 +1255,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1255 | {:title => 'Plugin2 tab', :id => 'plugin2_tab', :content => lambda { 'Content from plugin2.' }} | 1255 | {:title => 'Plugin2 tab', :id => 'plugin2_tab', :content => lambda { 'Content from plugin2.' }} |
| 1256 | end | 1256 | end |
| 1257 | end | 1257 | end |
| 1258 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) | ||
| 1258 | 1259 | ||
| 1259 | e = profile.environment | 1260 | e = profile.environment |
| 1260 | e.enable_plugin(Plugin1.name) | 1261 | e.enable_plugin(Plugin1.name) |
test/functional/profile_editor_controller_test.rb
| @@ -868,6 +868,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -868,6 +868,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 868 | {:title => "Plugin2 button", :icon => 'plugin2_icon', :url => 'plugin2_url'} | 868 | {:title => "Plugin2 button", :icon => 'plugin2_icon', :url => 'plugin2_url'} |
| 869 | end | 869 | end |
| 870 | end | 870 | end |
| 871 | + Noosfero::Plugin.stubs(:all).returns([TestControlPanelButtons1.to_s, TestControlPanelButtons2.to_s]) | ||
| 871 | 872 | ||
| 872 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestControlPanelButtons1.new, TestControlPanelButtons2.new]) | 873 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestControlPanelButtons1.new, TestControlPanelButtons2.new]) |
| 873 | 874 | ||
| @@ -883,6 +884,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -883,6 +884,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 883 | "<input id='field_added_by_plugin' value='value_of_field_added_by_plugin'/>" | 884 | "<input id='field_added_by_plugin' value='value_of_field_added_by_plugin'/>" |
| 884 | end | 885 | end |
| 885 | end | 886 | end |
| 887 | + Noosfero::Plugin.stubs(:all).returns([TestProfileEditPlugin.to_s]) | ||
| 886 | 888 | ||
| 887 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestProfileEditPlugin.new]) | 889 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestProfileEditPlugin.new]) |
| 888 | 890 | ||
| @@ -911,6 +913,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -911,6 +913,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 911 | lambda {"<strong>Plugin2 text</strong>"} | 913 | lambda {"<strong>Plugin2 text</strong>"} |
| 912 | end | 914 | end |
| 913 | end | 915 | end |
| 916 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) | ||
| 914 | 917 | ||
| 915 | Environment.default.enable_plugin(Plugin1) | 918 | Environment.default.enable_plugin(Plugin1) |
| 916 | Environment.default.enable_plugin(Plugin2) | 919 | Environment.default.enable_plugin(Plugin2) |
| @@ -932,6 +935,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -932,6 +935,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 932 | lambda {"<strong>Plugin2 text</strong>"} | 935 | lambda {"<strong>Plugin2 text</strong>"} |
| 933 | end | 936 | end |
| 934 | end | 937 | end |
| 938 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) | ||
| 935 | 939 | ||
| 936 | Environment.default.enable_plugin(Plugin1) | 940 | Environment.default.enable_plugin(Plugin1) |
| 937 | Environment.default.enable_plugin(Plugin2) | 941 | Environment.default.enable_plugin(Plugin2) |
test/functional/search_controller_test.rb
| @@ -163,6 +163,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -163,6 +163,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 163 | lambda {"<span id='plugin2'>This is Plugin2 speaking!</span>"} | 163 | lambda {"<span id='plugin2'>This is Plugin2 speaking!</span>"} |
| 164 | end | 164 | end |
| 165 | end | 165 | end |
| 166 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) | ||
| 166 | 167 | ||
| 167 | enterprise = fast_create(Enterprise) | 168 | enterprise = fast_create(Enterprise) |
| 168 | prod_cat = fast_create(ProductCategory) | 169 | prod_cat = fast_create(ProductCategory) |
| @@ -189,6 +190,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -189,6 +190,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 189 | return { :name => _('Property2'), :content => lambda { link_to(product.name, '/plugin2') } } | 190 | return { :name => _('Property2'), :content => lambda { link_to(product.name, '/plugin2') } } |
| 190 | end | 191 | end |
| 191 | end | 192 | end |
| 193 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) | ||
| 192 | enterprise = fast_create(Enterprise) | 194 | enterprise = fast_create(Enterprise) |
| 193 | prod_cat = fast_create(ProductCategory) | 195 | prod_cat = fast_create(ProductCategory) |
| 194 | product = fast_create(Product, {:profile_id => enterprise.id, :name => "produto1", :product_category_id => prod_cat.id}, :search => true) | 196 | product = fast_create(Product, {:profile_id => enterprise.id, :name => "produto1", :product_category_id => prod_cat.id}, :search => true) |
test/unit/application_helper_test.rb
| @@ -676,6 +676,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase | @@ -676,6 +676,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase | ||
| 676 | should 'parse macros' do | 676 | should 'parse macros' do |
| 677 | class Plugin1 < Noosfero::Plugin | 677 | class Plugin1 < Noosfero::Plugin |
| 678 | end | 678 | end |
| 679 | + Noosfero::Plugin.stubs(:all).returns(['ApplicationHelperTest::Plugin1']) | ||
| 679 | 680 | ||
| 680 | class Plugin1::Macro1 < Noosfero::Plugin::Macro | 681 | class Plugin1::Macro1 < Noosfero::Plugin::Macro |
| 681 | def parse(params, inner_html, source) | 682 | def parse(params, inner_html, source) |
test/unit/comment_test.rb
| @@ -468,8 +468,8 @@ class CommentTest < ActiveSupport::TestCase | @@ -468,8 +468,8 @@ class CommentTest < ActiveSupport::TestCase | ||
| 468 | end | 468 | end |
| 469 | end | 469 | end |
| 470 | 470 | ||
| 471 | - | ||
| 472 | should 'delegate spam detection to plugins' do | 471 | should 'delegate spam detection to plugins' do |
| 472 | + Noosfero::Plugin.stubs(:all).returns(['CommentTest::EverythingIsSpam']) | ||
| 473 | Environment.default.enable_plugin(EverythingIsSpam) | 473 | Environment.default.enable_plugin(EverythingIsSpam) |
| 474 | 474 | ||
| 475 | c1 = create_comment | 475 | c1 = create_comment |
| @@ -495,6 +495,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -495,6 +495,7 @@ class CommentTest < ActiveSupport::TestCase | ||
| 495 | end | 495 | end |
| 496 | 496 | ||
| 497 | should 'notify plugins of comments being marked as spam' do | 497 | should 'notify plugins of comments being marked as spam' do |
| 498 | + Noosfero::Plugin.stubs(:all).returns(['CommentTest::SpamNotification']) | ||
| 498 | Environment.default.enable_plugin(SpamNotification) | 499 | Environment.default.enable_plugin(SpamNotification) |
| 499 | 500 | ||
| 500 | c = create_comment | 501 | c = create_comment |
| @@ -506,6 +507,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -506,6 +507,7 @@ class CommentTest < ActiveSupport::TestCase | ||
| 506 | end | 507 | end |
| 507 | 508 | ||
| 508 | should 'notify plugins of comments being marked as ham' do | 509 | should 'notify plugins of comments being marked as ham' do |
| 510 | + Noosfero::Plugin.stubs(:all).returns(['CommentTest::SpamNotification']) | ||
| 509 | Environment.default.enable_plugin(SpamNotification) | 511 | Environment.default.enable_plugin(SpamNotification) |
| 510 | 512 | ||
| 511 | c = create_comment | 513 | c = create_comment |
test/unit/forgot_password_helper_test.rb
| @@ -22,6 +22,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | @@ -22,6 +22,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | ||
| 22 | {:field => 'f3', :name => 'F3', :model => 'person'}] | 22 | {:field => 'f3', :name => 'F3', :model => 'person'}] |
| 23 | end | 23 | end |
| 24 | end | 24 | end |
| 25 | + Noosfero::Plugin.stubs(:all).returns(['ForgotPasswordHelperTest::Plugin1', 'ForgotPasswordHelperTest::Plugin2']) | ||
| 25 | 26 | ||
| 26 | environment.enable_plugin(Plugin1) | 27 | environment.enable_plugin(Plugin1) |
| 27 | environment.enable_plugin(Plugin2) | 28 | environment.enable_plugin(Plugin2) |
| @@ -43,6 +44,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | @@ -43,6 +44,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | ||
| 43 | {:field => 'f3', :name => 'F3', :model => 'person'}] | 44 | {:field => 'f3', :name => 'F3', :model => 'person'}] |
| 44 | end | 45 | end |
| 45 | end | 46 | end |
| 47 | + Noosfero::Plugin.stubs(:all).returns(['ForgotPasswordHelperTest::Plugin1', 'ForgotPasswordHelperTest::Plugin2']) | ||
| 46 | 48 | ||
| 47 | environment.enable_plugin(Plugin1) | 49 | environment.enable_plugin(Plugin1) |
| 48 | environment.enable_plugin(Plugin2) | 50 | environment.enable_plugin(Plugin2) |
| @@ -64,6 +66,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | @@ -64,6 +66,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | ||
| 64 | {:field => 'f3', :name => 'F3', :model => 'user'}] | 66 | {:field => 'f3', :name => 'F3', :model => 'user'}] |
| 65 | end | 67 | end |
| 66 | end | 68 | end |
| 69 | + Noosfero::Plugin.stubs(:all).returns(['ForgotPasswordHelperTest::Plugin1', 'ForgotPasswordHelperTest::Plugin2']) | ||
| 67 | 70 | ||
| 68 | environment.enable_plugin(Plugin1) | 71 | environment.enable_plugin(Plugin1) |
| 69 | environment.enable_plugin(Plugin2) | 72 | environment.enable_plugin(Plugin2) |
| @@ -85,6 +88,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | @@ -85,6 +88,7 @@ class ForgotPasswordHelperTest < ActionView::TestCase | ||
| 85 | {:field => 'f3', :name => 'F3', :model => 'user'}] | 88 | {:field => 'f3', :name => 'F3', :model => 'user'}] |
| 86 | end | 89 | end |
| 87 | end | 90 | end |
| 91 | + Noosfero::Plugin.stubs(:all).returns(['ForgotPasswordHelperTest::Plugin1', 'ForgotPasswordHelperTest::Plugin2']) | ||
| 88 | 92 | ||
| 89 | environment.enable_plugin(Plugin1) | 93 | environment.enable_plugin(Plugin1) |
| 90 | environment.enable_plugin(Plugin2) | 94 | environment.enable_plugin(Plugin2) |
test/unit/macros_helper_test.rb
| @@ -28,6 +28,7 @@ class MacrosHelperTest < ActiveSupport::TestCase | @@ -28,6 +28,7 @@ class MacrosHelperTest < ActiveSupport::TestCase | ||
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | def setup | 30 | def setup |
| 31 | + Noosfero::Plugin.stubs(:all).returns(['MacrosHelperTest::Plugin1']) | ||
| 31 | @environment = Environment.default | 32 | @environment = Environment.default |
| 32 | @environment.enable_plugin(Plugin1) | 33 | @environment.enable_plugin(Plugin1) |
| 33 | @plugins = Noosfero::Plugin::Manager.new(@environment, self) | 34 | @plugins = Noosfero::Plugin::Manager.new(@environment, self) |
test/unit/person_test.rb
| @@ -1255,6 +1255,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -1255,6 +1255,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 1255 | false | 1255 | false |
| 1256 | end | 1256 | end |
| 1257 | end | 1257 | end |
| 1258 | + Noosfero::Plugin.stubs(:all).returns(['PersonTest::Plugin1', 'PersonTest::Plugin2']) | ||
| 1258 | 1259 | ||
| 1259 | e = Environment.default | 1260 | e = Environment.default |
| 1260 | e.enable_plugin(Plugin1.name) | 1261 | e.enable_plugin(Plugin1.name) |
| @@ -1424,6 +1425,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -1424,6 +1425,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 1424 | Profile.memberships_of(Person.find_by_identifier('person2')) | 1425 | Profile.memberships_of(Person.find_by_identifier('person2')) |
| 1425 | end | 1426 | end |
| 1426 | end | 1427 | end |
| 1428 | + Noosfero::Plugin.stubs(:all).returns(['PersonTest::Plugin1', 'PersonTest::Plugin2']) | ||
| 1427 | 1429 | ||
| 1428 | Environment.default.enable_plugin(Plugin1) | 1430 | Environment.default.enable_plugin(Plugin1) |
| 1429 | Environment.default.enable_plugin(Plugin2) | 1431 | Environment.default.enable_plugin(Plugin2) |
test/unit/plugin_manager_test.rb
| @@ -26,6 +26,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -26,6 +26,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 26 | class Plugin2 < Noosfero::Plugin; end; | 26 | class Plugin2 < Noosfero::Plugin; end; |
| 27 | class Plugin3 < Noosfero::Plugin; end; | 27 | class Plugin3 < Noosfero::Plugin; end; |
| 28 | class Plugin4 < Noosfero::Plugin; end; | 28 | class Plugin4 < Noosfero::Plugin; end; |
| 29 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2', 'PluginManagerTest::Plugin3', 'PluginManagerTest::Plugin4']) | ||
| 29 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s, Plugin4.to_s]) | 30 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s, Plugin4.to_s]) |
| 30 | Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin3.to_s, Plugin4.to_s]) | 31 | Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin3.to_s, Plugin4.to_s]) |
| 31 | results = plugins.enabled_plugins.map { |instance| instance.class.to_s } | 32 | results = plugins.enabled_plugins.map { |instance| instance.class.to_s } |
| @@ -51,6 +52,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -51,6 +52,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 51 | 'Plugin 2 action.' | 52 | 'Plugin 2 action.' |
| 52 | end | 53 | end |
| 53 | end | 54 | end |
| 55 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2']) | ||
| 54 | 56 | ||
| 55 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s]) | 57 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s]) |
| 56 | 58 | ||
| @@ -83,6 +85,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -83,6 +85,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 83 | 'Plugin 3 action.' | 85 | 'Plugin 3 action.' |
| 84 | end | 86 | end |
| 85 | end | 87 | end |
| 88 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2', 'PluginManagerTest::Plugin3']) | ||
| 86 | 89 | ||
| 87 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s, Plugin3.to_s]) | 90 | environment.stubs(:enabled_plugins).returns([Plugin1.to_s, Plugin2.to_s, Plugin3.to_s]) |
| 88 | p1 = Plugin1.new | 91 | p1 = Plugin1.new |
| @@ -107,6 +110,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -107,6 +110,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 107 | 'Plugin3' | 110 | 'Plugin3' |
| 108 | end | 111 | end |
| 109 | end | 112 | end |
| 113 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2', 'PluginManagerTest::Plugin3']) | ||
| 110 | 114 | ||
| 111 | environment.enable_plugin(Plugin1.name) | 115 | environment.enable_plugin(Plugin1.name) |
| 112 | environment.enable_plugin(Plugin2.name) | 116 | environment.enable_plugin(Plugin2.name) |
| @@ -134,6 +138,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -134,6 +138,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 134 | true | 138 | true |
| 135 | end | 139 | end |
| 136 | end | 140 | end |
| 141 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2', 'PluginManagerTest::Plugin3']) | ||
| 137 | 142 | ||
| 138 | environment.enable_plugin(Plugin1.name) | 143 | environment.enable_plugin(Plugin1.name) |
| 139 | environment.enable_plugin(Plugin2.name) | 144 | environment.enable_plugin(Plugin2.name) |
| @@ -162,6 +167,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -162,6 +167,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 162 | true | 167 | true |
| 163 | end | 168 | end |
| 164 | end | 169 | end |
| 170 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2', 'PluginManagerTest::Plugin3']) | ||
| 165 | 171 | ||
| 166 | environment.enable_plugin(Plugin1.name) | 172 | environment.enable_plugin(Plugin1.name) |
| 167 | environment.enable_plugin(Plugin2.name) | 173 | environment.enable_plugin(Plugin2.name) |
| @@ -178,6 +184,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -178,6 +184,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 178 | [Macro1, Macro2] | 184 | [Macro1, Macro2] |
| 179 | end | 185 | end |
| 180 | end | 186 | end |
| 187 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1']) | ||
| 181 | 188 | ||
| 182 | class Plugin1::Macro1 < Noosfero::Plugin::Macro | 189 | class Plugin1::Macro1 < Noosfero::Plugin::Macro |
| 183 | def convert(macro, source) | 190 | def convert(macro, source) |
| @@ -212,6 +219,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -212,6 +219,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 212 | [v1 * v, v2 * v] | 219 | [v1 * v, v2 * v] |
| 213 | end | 220 | end |
| 214 | end | 221 | end |
| 222 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2']) | ||
| 215 | 223 | ||
| 216 | environment.enable_plugin(Plugin1) | 224 | environment.enable_plugin(Plugin1) |
| 217 | environment.enable_plugin(Plugin2) | 225 | environment.enable_plugin(Plugin2) |
| @@ -231,6 +239,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -231,6 +239,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 231 | value * 5 | 239 | value * 5 |
| 232 | end | 240 | end |
| 233 | end | 241 | end |
| 242 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2']) | ||
| 234 | 243 | ||
| 235 | environment.enable_plugin(Plugin1) | 244 | environment.enable_plugin(Plugin1) |
| 236 | environment.enable_plugin(Plugin2) | 245 | environment.enable_plugin(Plugin2) |
| @@ -252,6 +261,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -252,6 +261,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 252 | [v1 * v, v2 * v, 666] | 261 | [v1 * v, v2 * v, 666] |
| 253 | end | 262 | end |
| 254 | end | 263 | end |
| 264 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2']) | ||
| 255 | 265 | ||
| 256 | environment.enable_plugin(Plugin1) | 266 | environment.enable_plugin(Plugin1) |
| 257 | environment.enable_plugin(Plugin2) | 267 | environment.enable_plugin(Plugin2) |
| @@ -273,6 +283,7 @@ class PluginManagerTest < ActiveSupport::TestCase | @@ -273,6 +283,7 @@ class PluginManagerTest < ActiveSupport::TestCase | ||
| 273 | numbers.reject {|n| n<=5} | 283 | numbers.reject {|n| n<=5} |
| 274 | end | 284 | end |
| 275 | end | 285 | end |
| 286 | + Noosfero::Plugin.stubs(:all).returns(['PluginManagerTest::Plugin1', 'PluginManagerTest::Plugin2']) | ||
| 276 | 287 | ||
| 277 | environment.enable_plugin(Plugin1) | 288 | environment.enable_plugin(Plugin1) |
| 278 | environment.enable_plugin(Plugin2) | 289 | environment.enable_plugin(Plugin2) |
test/unit/plugin_test.rb
| @@ -9,15 +9,9 @@ class PluginTest < ActiveSupport::TestCase | @@ -9,15 +9,9 @@ class PluginTest < ActiveSupport::TestCase | ||
| 9 | 9 | ||
| 10 | include Noosfero::Plugin::HotSpot | 10 | include Noosfero::Plugin::HotSpot |
| 11 | 11 | ||
| 12 | - should 'keep the list of all loaded subclasses' do | ||
| 13 | - class Plugin1 < Noosfero::Plugin | ||
| 14 | - end | ||
| 15 | - | ||
| 16 | - class Plugin2 < Noosfero::Plugin | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | - assert_includes Noosfero::Plugin.all, Plugin1.to_s | ||
| 20 | - assert_includes Noosfero::Plugin.all, Plugin2.to_s | 12 | + should 'keep the list of all available plugins' do |
| 13 | + assert File.directory?(File.join(Rails.root, 'plugins', 'foo')) | ||
| 14 | + assert_includes Noosfero::Plugin.all, 'FooPlugin' | ||
| 21 | end | 15 | end |
| 22 | 16 | ||
| 23 | should 'returns url to plugin management if plugin has admin_controller' do | 17 | should 'returns url to plugin management if plugin has admin_controller' do |
test/unit/profile_test.rb
| @@ -1812,6 +1812,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -1812,6 +1812,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
| 1812 | Person.members_of(Community.find_by_identifier('community2')) | 1812 | Person.members_of(Community.find_by_identifier('community2')) |
| 1813 | end | 1813 | end |
| 1814 | end | 1814 | end |
| 1815 | + Noosfero::Plugin.stubs(:all).returns(['ProfileTest::Plugin1', 'ProfileTest::Plugin2']) | ||
| 1815 | Environment.default.enable_plugin(Plugin1) | 1816 | Environment.default.enable_plugin(Plugin1) |
| 1816 | Environment.default.enable_plugin(Plugin2) | 1817 | Environment.default.enable_plugin(Plugin2) |
| 1817 | 1818 | ||
| @@ -1969,6 +1970,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -1969,6 +1970,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
| 1969 | end | 1970 | end |
| 1970 | 1971 | ||
| 1971 | environment = Environment.default | 1972 | environment = Environment.default |
| 1973 | + Noosfero::Plugin.stubs(:all).returns(['ProfileTest::Plugin1']) | ||
| 1972 | environment.enable_plugin(Plugin1) | 1974 | environment.enable_plugin(Plugin1) |
| 1973 | plugins = Noosfero::Plugin::Manager.new(environment, self) | 1975 | plugins = Noosfero::Plugin::Manager.new(environment, self) |
| 1974 | p = fast_create(Profile) | 1976 | p = fast_create(Profile) |
test/unit/suggest_article_test.rb
| @@ -7,6 +7,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -7,6 +7,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
| 7 | ActionMailer::Base.perform_deliveries = true | 7 | ActionMailer::Base.perform_deliveries = true |
| 8 | ActionMailer::Base.deliveries = [] | 8 | ActionMailer::Base.deliveries = [] |
| 9 | @profile = create_user('test_user').person | 9 | @profile = create_user('test_user').person |
| 10 | + Noosfero::Plugin.stubs(:all).returns(['SuggestArticleTest::EverythingIsSpam', 'SuggestArticleTest::SpamNotification']) | ||
| 10 | end | 11 | end |
| 11 | attr_reader :profile | 12 | attr_reader :profile |
| 12 | 13 |