diff options
author | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-03-06 05:31:39 +0000 |
---|---|---|
committer | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-03-06 05:31:39 +0000 |
commit | bbaf6bb51edf0402faad07191cc042d5297ed2fc (patch) | |
tree | 205f3077cd32a81443a7627bba778e70ac7de32c /projects/gem_plugin/test/test_plugins.rb | |
parent | a4a2f19a0c94e72641d3b43c66d7817d2b9c30a9 (diff) | |
download | unicorn-bbaf6bb51edf0402faad07191cc042d5297ed2fc.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@83 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'projects/gem_plugin/test/test_plugins.rb')
-rw-r--r-- | projects/gem_plugin/test/test_plugins.rb | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/projects/gem_plugin/test/test_plugins.rb b/projects/gem_plugin/test/test_plugins.rb new file mode 100644 index 0000000..39a12e6 --- /dev/null +++ b/projects/gem_plugin/test/test_plugins.rb @@ -0,0 +1,73 @@ +require 'test/unit' +require 'gem_plugin' + +include GemPlugin + +class ATestPlugin < GemPlugin::Plugin "/stuff" +end + +class First < GemPlugin::Plugin "/commands" + def initialize(options = {}) + puts "First with options: #{options.inspect}" + end +end + +class Second < GemPlugin::Plugin "/commands" + def initialize(options = {}) + puts "Second with options: #{options.inspect}" + end +end + +class Last < GemPlugin::Plugin "/commands" + def initialize(options = {}) + puts "Last with options: #{options.inspect}" + end +end + + +class PluginTest < Test::Unit::TestCase + + def setup + @pmgr = Manager.instance + @pmgr.load({"rails" => EXCLUDE}) + @categories = ["/commands"] + @names = ["/first", "/second", "/last", "/atestplugin"] + end + + def test_load_plugins + puts "#{@pmgr.available.inspect}" + @pmgr.available.each {|cat,plugins| + plugins.each do |n,p| + puts "TEST: #{cat}#{n}" + assert @names.include?(n) + end + } + + @pmgr.load + @pmgr.available.each do |cat,plugins| + plugins.each do |n,p| + STDERR.puts "#{cat}#{n}" + plugin = @pmgr.create("#{cat}#{n}", options={"name" => p}) + end + end + end + + def test_similar_uris + + @pmgr.register("/test", "/testme", ATestPlugin) + @pmgr.register("/test2", "/testme", ATestPlugin) + + assert_equal @pmgr.create("/test/testme").class, ATestPlugin + assert_equal @pmgr.create("/test2/testme").class, ATestPlugin + + end + + + def test_create + last = @pmgr.create("/commands/last", "test" => "stuff") + assert last != nil, "Didn't make the right plugin" + first = @pmgr.create("/commands/last") + assert first != nil, "Didn't make the right plugin" + end + +end |