From ede647a505fbba459d4e8529646b1f5cb59c1d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 12 Dec 2011 19:23:13 +0100 Subject: Allow reloader to be configured. --- actionpack/test/dispatch/reloader_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test/dispatch/reloader_test.rb') diff --git a/actionpack/test/dispatch/reloader_test.rb b/actionpack/test/dispatch/reloader_test.rb index eaabc1feb3..bd24256427 100644 --- a/actionpack/test/dispatch/reloader_test.rb +++ b/actionpack/test/dispatch/reloader_test.rb @@ -43,6 +43,19 @@ class ReloaderTest < Test::Unit::TestCase assert_respond_to body, :close end + def test_condition_specifies_when_to_reload + i, j = 0, 0, 0, 0 + Reloader.to_prepare { |*args| i += 1 } + Reloader.to_cleanup { |*args| j += 1 } + app = Reloader.new(lambda { |env| [200, {}, []] }, lambda { i < 3 }) + 5.times do + resp = app.call({}) + resp[2].close + end + assert_equal 3, i + assert_equal 3, j + end + def test_returned_body_object_behaves_like_underlying_object body = call_and_return_body do b = MyBody.new -- cgit v1.2.3