Instiki 0.17.2: Security Release
This release upgrades Instiki to Rails 2.3.4, which patches two security holes in Rails. See http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4 There are also some new features, and the usual boatload of bugfixes. See the CHANGELOG for details.
This commit is contained in:
parent
34c4306867
commit
4bdf703ab2
211 changed files with 3959 additions and 1325 deletions
|
@ -22,35 +22,62 @@ class ReloaderTests < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def setup_and_return_body(app = lambda { })
|
||||
Dispatcher.expects(:reload_application)
|
||||
reloader = Reloader.new(app)
|
||||
headers, status, body = reloader.call({ })
|
||||
body
|
||||
def setup
|
||||
@lock = Mutex.new
|
||||
end
|
||||
|
||||
def test_it_reloads_the_application_before_the_request
|
||||
def test_it_reloads_the_application_before_yielding
|
||||
Dispatcher.expects(:reload_application)
|
||||
reloader = Reloader.new(lambda {
|
||||
Reloader.run(@lock) do
|
||||
[200, { "Content-Type" => "text/html" }, [""]]
|
||||
})
|
||||
reloader.call({ })
|
||||
end
|
||||
end
|
||||
|
||||
def test_it_locks_before_yielding
|
||||
lock = DummyMutex.new
|
||||
Dispatcher.expects(:reload_application)
|
||||
Reloader.run(lock) do
|
||||
assert lock.locked?
|
||||
[200, { "Content-Type" => "text/html" }, [""]]
|
||||
end
|
||||
assert lock.locked?
|
||||
end
|
||||
|
||||
def test_it_unlocks_upon_calling_close_on_body
|
||||
lock = DummyMutex.new
|
||||
Dispatcher.expects(:reload_application)
|
||||
headers, status, body = Reloader.run(lock) do
|
||||
[200, { "Content-Type" => "text/html" }, [""]]
|
||||
end
|
||||
body.close
|
||||
assert !lock.locked?
|
||||
end
|
||||
|
||||
def test_it_unlocks_if_app_object_raises_exception
|
||||
lock = DummyMutex.new
|
||||
Dispatcher.expects(:reload_application)
|
||||
assert_raise(RuntimeError) do
|
||||
Reloader.run(lock) do
|
||||
raise "oh no!"
|
||||
end
|
||||
end
|
||||
assert !lock.locked?
|
||||
end
|
||||
|
||||
def test_returned_body_object_always_responds_to_close
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
[200, { "Content-Type" => "text/html" }, [""]]
|
||||
})
|
||||
end
|
||||
assert body.respond_to?(:close)
|
||||
end
|
||||
|
||||
def test_returned_body_object_behaves_like_underlying_object
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
b = MyBody.new
|
||||
b << "hello"
|
||||
b << "world"
|
||||
[200, { "Content-Type" => "text/html" }, b]
|
||||
})
|
||||
end
|
||||
assert_equal 2, body.size
|
||||
assert_equal "hello", body[0]
|
||||
assert_equal "world", body[1]
|
||||
|
@ -60,20 +87,20 @@ class ReloaderTests < ActiveSupport::TestCase
|
|||
|
||||
def test_it_calls_close_on_underlying_object_when_close_is_called_on_body
|
||||
close_called = false
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
b = MyBody.new do
|
||||
close_called = true
|
||||
end
|
||||
[200, { "Content-Type" => "text/html" }, b]
|
||||
})
|
||||
end
|
||||
body.close
|
||||
assert close_called
|
||||
end
|
||||
|
||||
def test_returned_body_object_responds_to_all_methods_supported_by_underlying_object
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
[200, { "Content-Type" => "text/html" }, MyBody.new]
|
||||
})
|
||||
end
|
||||
assert body.respond_to?(:size)
|
||||
assert body.respond_to?(:each)
|
||||
assert body.respond_to?(:foo)
|
||||
|
@ -82,16 +109,16 @@ class ReloaderTests < ActiveSupport::TestCase
|
|||
|
||||
def test_it_doesnt_clean_up_the_application_after_call
|
||||
Dispatcher.expects(:cleanup_application).never
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
[200, { "Content-Type" => "text/html" }, MyBody.new]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
def test_it_cleans_up_the_application_when_close_is_called_on_body
|
||||
Dispatcher.expects(:cleanup_application)
|
||||
body = setup_and_return_body(lambda {
|
||||
status, headers, body = Reloader.run(@lock) do
|
||||
[200, { "Content-Type" => "text/html" }, MyBody.new]
|
||||
})
|
||||
end
|
||||
body.close
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue