about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-23 02:17:20 +0000
committerEric Wong <e@80x24.org>2015-01-23 02:17:20 +0000
commit1faf2322b0776f7e51d4aa1f776ee4a0d268bff1 (patch)
tree73564d8d8615878e7199a0be828e52cdd0036636 /test
parent004078c979dfb6323f20659ddeb9e329c523b071 (diff)
downloadyahns-1faf2322b0776f7e51d4aa1f776ee4a0d268bff1.tar.gz
Since we only support 1.9.3+, io.stat.size may be simplified
to io.size to reduce allocations of File::Stat objects.
Diffstat (limited to 'test')
-rw-r--r--test/test_output_buffering.rb2
-rw-r--r--test/test_stream_file.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/test/test_output_buffering.rb b/test/test_output_buffering.rb
index 4911b21..9e2e400 100644
--- a/test/test_output_buffering.rb
+++ b/test/test_output_buffering.rb
@@ -123,7 +123,7 @@ class TestOutputBuffering < Testcase
           def gplv3.each
             raise "SHOULD NOT BE CALLED"
           end
-          size = gplv3.stat.size
+          size = gplv3.size
           len = size.to_s
           ranges = Rack::Utils.byte_ranges(e, size)
           status = 200
diff --git a/test/test_stream_file.rb b/test/test_stream_file.rb
index 7dbd512..54344f4 100644
--- a/test/test_stream_file.rb
+++ b/test/test_stream_file.rb
@@ -9,7 +9,7 @@ class TestStreamFile < Testcase
 
   def test_stream_file
     fp = File.open("COPYING")
-    sf = Yahns::StreamFile.new(fp, true, 0, fp.stat.size)
+    sf = Yahns::StreamFile.new(fp, true, 0, fp.size)
     refute sf.respond_to?(:close)
     sf.wbuf_close(nil)
     assert fp.closed?
@@ -18,7 +18,7 @@ class TestStreamFile < Testcase
   def test_fd
     fp = File.open("COPYING")
     obj = DevFD.new("/dev/fd/#{fp.fileno}")
-    sf = Yahns::StreamFile.new(obj, true, 0, fp.stat.size)
+    sf = Yahns::StreamFile.new(obj, true, 0, fp.size)
     io = sf.instance_variable_get :@tmpio
     assert_instance_of IO, io.to_io
     assert_equal fp.fileno, io.fileno