Instiki 0.16.5

Update to Rails 2.3.2 (the stable Rails 2.3 release).
Add audio/speex support
Update CHANGELOG
Bump version number
This commit is contained in:
Jacques Distler 2009-03-16 09:55:30 -05:00
parent 801d307405
commit e2ccdfd812
264 changed files with 4850 additions and 1906 deletions

View file

@ -30,3 +30,32 @@ if defined? Test::Unit::Util::BacktraceFilter
else
$stderr.puts 'No BacktraceFilter for minitest'
end
class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase
def setup
@cleaner = Rails::BacktraceCleaner.new
end
test "should format installed gems correctly" do
@backtrace = [ "#{Gem.default_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
@result = @cleaner.clean(@backtrace)
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
end
test "should format installed gems not in Gem.default_dir correctly" do
@target_dir = Gem.path.detect { |p| p != Gem.default_dir }
# skip this test if default_dir is the only directory on Gem.path
if @target_dir
@backtrace = [ "#{@target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
@result = @cleaner.clean(@backtrace)
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
end
end
test "should format vendor gems correctly" do
@backtrace = [ "#{Rails::GemDependency.unpacked_path}/nosuchgem-1.2.3/lib/foo.rb" ]
@result = @cleaner.clean(@backtrace)
assert_equal "nosuchgem (1.2.3) [v] lib/foo.rb", @result[0]
end
end

View file

@ -62,6 +62,8 @@ class VendorBootTest < Test::Unit::TestCase
def test_load_initializer_requires_from_vendor_rails
boot = VendorBoot.new
boot.expects(:require).with("#{RAILS_ROOT}/vendor/rails/railties/lib/initializer")
Rails::Initializer.expects(:run).with(:install_gem_spec_stubs)
Rails::GemDependency.expects(:add_frozen_gem_path)
boot.load_initializer
end
end

View file

@ -1,5 +1,5 @@
class MetalA < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -1,5 +1,5 @@
class MetalB < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -0,0 +1,5 @@
class LegacyRoutes < Rails::Rack::Metal
def self.call(env)
[301, { "Location" => "http://example.com"}, []]
end
end

View file

@ -1,5 +1,5 @@
class FooMetal < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -1,7 +1,7 @@
module Folder
class MetalA < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end
end

View file

@ -1,7 +1,7 @@
module Folder
class MetalB < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end
end

View file

@ -1,3 +1,3 @@
# My app/models dir must be in the load path.
require 'engine_model'
raise 'missing model from my app/models dir' unless defined?(EngineModel)
raise LoadError, 'missing model from my app/models dir' unless defined?(EngineModel)

View file

@ -0,0 +1 @@
/foo/bar.html

View file

@ -0,0 +1 @@
/foo/index.html

View file

@ -0,0 +1 @@
/index.html

View file

@ -46,31 +46,34 @@ class GemDependencyTest < Test::Unit::TestCase
end
def test_gem_adds_load_paths
@gem.expects(:gem).with(Gem::Dependency.new(@gem.name, nil))
@gem.expects(:gem).with(@gem)
@gem.add_load_paths
end
def test_gem_with_version_adds_load_paths
@gem_with_version.expects(:gem).with(Gem::Dependency.new(@gem_with_version.name, @gem_with_version.requirement.to_s))
@gem_with_version.expects(:gem).with(@gem_with_version)
@gem_with_version.add_load_paths
assert @gem_with_version.load_paths_added?
end
def test_gem_loading
@gem.expects(:gem).with(Gem::Dependency.new(@gem.name, nil))
@gem.expects(:gem).with(@gem)
@gem.expects(:require).with(@gem.name)
@gem.add_load_paths
@gem.load
assert @gem.loaded?
end
def test_gem_with_lib_loading
@gem_with_lib.expects(:gem).with(Gem::Dependency.new(@gem_with_lib.name, nil))
@gem_with_lib.expects(:gem).with(@gem_with_lib)
@gem_with_lib.expects(:require).with(@gem_with_lib.lib)
@gem_with_lib.add_load_paths
@gem_with_lib.load
assert @gem_with_lib.loaded?
end
def test_gem_without_lib_loading
@gem_without_load.expects(:gem).with(Gem::Dependency.new(@gem_without_load.name, nil))
@gem_without_load.expects(:gem).with(@gem_without_load)
@gem_without_load.expects(:require).with(@gem_without_load.lib).never
@gem_without_load.add_load_paths
@gem_without_load.load
@ -132,8 +135,8 @@ class GemDependencyTest < Test::Unit::TestCase
dummy_gem = Rails::GemDependency.new "dummy-gem-g"
dummy_gem.add_load_paths
dummy_gem.load
assert dummy_gem.loaded?
assert_equal 2, dummy_gem.dependencies(:flatten => true).size
assert_equal 1, dummy_gem.dependencies.size
assert_equal 1, dummy_gem.dependencies.first.dependencies.size
assert_nothing_raised do
dummy_gem.dependencies.each do |g|
g.dependencies

View file

@ -93,6 +93,11 @@ class RailsTemplateRunnerTest < GeneratorTestCase
assert_generated_file_with_data('config/environments/test.rb', "config.gem 'quietbacktrace'")
end
def test_gem_with_lib_option_set_to_false_should_put_gem_dependency_in_enviroment_correctly
run_template_method(:gem, 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com')
assert_rails_initializer_includes("config.gem 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com'")
end
def test_environment_should_include_data_in_environment_initializer_block
load_paths = 'config.load_paths += %w["#{RAILS_ROOT}/app/extras"]'
run_template_method(:environment, load_paths)

View file

@ -237,7 +237,7 @@ class InitializerPluginLoadingTests < Test::Unit::TestCase
def test_registering_a_plugin_name_that_does_not_exist_raises_a_load_error
only_load_the_following_plugins! [:stubby, :acts_as_a_non_existant_plugin]
assert_raises(LoadError) do
assert_raise(LoadError) do
load_plugins!
end
end

View file

@ -8,6 +8,12 @@ class MetalTest < Test::Unit::TestCase
end
end
def test_metals_should_respect_class_name_conventions
use_appdir("pluralmetal") do
assert_equal(["LegacyRoutes"], found_metals_as_string_array)
end
end
def test_metals_should_return_alphabetical_list_of_found_metal_apps
use_appdir("multiplemetals") do
assert_equal(["MetalA", "MetalB"], found_metals_as_string_array)
@ -41,6 +47,15 @@ class MetalTest < Test::Unit::TestCase
end
end
def test_metal_finding_should_work_with_multiple_metal_paths_in_185_and_below
use_appdir("singlemetal") do
engine_metal_path = "#{File.dirname(__FILE__)}/fixtures/plugins/engines/engine/app/metal"
Rails::Rack::Metal.metal_paths << engine_metal_path
$LOAD_PATH << engine_metal_path
assert_equal(["FooMetal", "EngineMetal"], found_metals_as_string_array)
end
end
private
def use_appdir(root)

View file

@ -2,7 +2,7 @@ require 'plugin_test_helper'
class PluginLocatorTest < Test::Unit::TestCase
def test_should_require_subclasses_to_implement_the_plugins_method
assert_raises(RuntimeError) do
assert_raise(RuntimeError) do
Rails::Plugin::Locator.new(nil).plugins
end
end

View file

@ -52,11 +52,11 @@ class PluginTest < Test::Unit::TestCase
plugin_for(@valid_plugin_path).load_paths
end
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin_for(@empty_plugin_path).load_paths
end
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin_for('this_is_not_a_plugin_directory').load_paths
end
end
@ -77,13 +77,13 @@ class PluginTest < Test::Unit::TestCase
end
# This is an empty path so it raises
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin = plugin_for(@empty_plugin_path)
plugin.stubs(:evaluate_init_rb)
plugin.send(:load, @initializer)
end
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin = plugin_for('this_is_not_a_plugin_directory')
plugin.stubs(:evaluate_init_rb)
plugin.send(:load, @initializer)
@ -97,11 +97,11 @@ class PluginTest < Test::Unit::TestCase
end
# This is an empty path so it raises
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin_for(@empty_plugin_path).load_paths
end
assert_raises(LoadError) do
assert_raise(LoadError) do
plugin_for('this_is_not_a_plugin_directory').load_paths
end
end

View file

@ -0,0 +1,46 @@
require 'abstract_unit'
require 'action_controller'
require 'rails/rack'
class RackStaticTest < ActiveSupport::TestCase
def setup
FileUtils.cp_r "#{RAILS_ROOT}/fixtures/public", "#{RAILS_ROOT}/public"
end
def teardown
FileUtils.rm_rf "#{RAILS_ROOT}/public"
end
DummyApp = lambda { |env|
[200, {"Content-Type" => "text/plain"}, ["Hello, World!"]]
}
App = Rails::Rack::Static.new(DummyApp)
test "serves dynamic content" do
assert_equal "Hello, World!", get("/nofile")
end
test "serves static index at root" do
assert_equal "/index.html", get("/index.html")
assert_equal "/index.html", get("/index")
assert_equal "/index.html", get("/")
end
test "serves static file in directory" do
assert_equal "/foo/bar.html", get("/foo/bar.html")
assert_equal "/foo/bar.html", get("/foo/bar/")
assert_equal "/foo/bar.html", get("/foo/bar")
end
test "serves static index file in directory" do
assert_equal "/foo/index.html", get("/foo/index.html")
assert_equal "/foo/index.html", get("/foo/")
assert_equal "/foo/index.html", get("/foo")
end
private
def get(path)
Rack::MockRequest.new(App).request("GET", path).body
end
end

View file

@ -9,7 +9,7 @@ date: 2008-10-03 00:00:00 -04:00
dependencies:
- !ruby/object:Gem::Dependency
name: dummy-gem-f
type: :development
type: :runtime
version_requirement:
version_requirements: !ruby/object:Gem::Requirement
requirements: