ref: master
test/functional/plugins_controller_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
require_relative '../test_helper' class PluginsControllerTest < ActionController::TestCase all_fixtures def setup @controller = PluginsController.new @environment = Environment.default login_as(create_admin_user(@environment)) end attr_reader :environment should 'list system active plugins' do class Plugin1 < Noosfero::Plugin class << self def plugin_name "Plugin1" end def plugin_description "This plugin is from hell!" end end end class Plugin2 < Noosfero::Plugin class << self def plugin_name "Plugin2" end def plugin_description "This plugin is from heaven!" end end end Noosfero::Plugin.stubs(:all).returns([Plugin1.to_s, Plugin2.to_s]) get :index assert_tag :tag => 'td', :content => /#{Plugin1.plugin_name}/ assert_tag :tag => 'td', :content => /#{Plugin1.plugin_description}/ assert_tag :tag => 'td', :content => /#{Plugin2.plugin_name}/ assert_tag :tag => 'td', :content => /#{Plugin2.plugin_description}/ end should 'enable or disable plugins' do assert_not_equal ['Plugin1'], environment.enabled_plugins post :update, :environment => { :enabled_plugins => ['Plugin1']} environment.reload assert_equal ['Plugin1'], environment.enabled_plugins end end |