From b2f98c13a3308e6db618d6f3f9f706cbc19f13fd Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Mar 2009 03:16:14 -0700 Subject: Simplify parts and tests --- actionpack/test/template/body_parts_test.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/body_parts_test.rb b/actionpack/test/template/body_parts_test.rb index 7418f4a716..4555a6b015 100644 --- a/actionpack/test/template/body_parts_test.rb +++ b/actionpack/test/template/body_parts_test.rb @@ -47,7 +47,7 @@ class QueuedPartTest < ActionController::TestCase end protected - def submit(job) + def enqueue(job) job.reverse end @@ -114,12 +114,11 @@ class ThreadedPartTest < ActionController::TestCase def test_concurrent_threaded_parts get :index - before = Time.now.to_i - thread_ids = @response.body.split('-').map { |part| part.split('::').first.to_i } - elapsed = Time.now.to_i - before - - assert_equal thread_ids.size, thread_ids.uniq.size - assert elapsed < 1.1 + elapsed = Benchmark.ms do + thread_ids = @response.body.split('-').map { |part| part.split('::').first.to_i } + assert_equal thread_ids.size, thread_ids.uniq.size + end + assert (elapsed - 1000).abs < 100, elapsed end end @@ -142,7 +141,7 @@ class OpenUriPartTest < ActionController::TestCase def render_url(url) url = URI.parse(url) - def url.read; path end + def url.read; sleep 1; path end response.template.punctuate_body! OpenUriPart.new(url) end end @@ -155,6 +154,6 @@ class OpenUriPartTest < ActionController::TestCase elapsed = Benchmark.ms do assert_equal '/foo/bar/baz', @response.body end - assert elapsed < 1.1 + assert (elapsed - 1000).abs < 100, elapsed end end -- cgit v1.2.3