aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/plugin_test_helper.rb
blob: adb62de665b2e9d7789e0fb2eeca0a6e9e78d6b9 (plain) (blame)
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
$:.unshift File.dirname(__FILE__) + "/../lib"
$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"

require 'test/unit'
require 'active_support'
require 'active_support/core/all'
require 'initializer'
require File.join(File.dirname(__FILE__), 'abstract_unit')

# We need to set RAILS_ROOT if it isn't already set
RAILS_ROOT = '.' unless defined?(RAILS_ROOT)

class Test::Unit::TestCase
  private  
    def plugin_fixture_root_path
      File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'plugins'))
    end
  
    def only_load_the_following_plugins!(plugins)
      @initializer.configuration.plugins = plugins
    end
  
    def plugin_fixture_path(path)
      File.join(plugin_fixture_root_path, path)
    end
    
    def assert_plugins(list_of_names, array_of_plugins, message=nil)
      assert_equal list_of_names.map { |n| n.to_s }, array_of_plugins.map { |p| p.name }, message
    end    
end