[Groonga-commit] ranguba/chupa-text at adc658a [master] Share common code

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jan 4 19:03:31 JST 2014


Kouhei Sutou	2014-01-04 19:03:31 +0900 (Sat, 04 Jan 2014)

  New Revision: adc658ac3be8672bd5d8a072745701f668d69417
  https://github.com/ranguba/chupa-text/commit/adc658ac3be8672bd5d8a072745701f668d69417

  Message:
    Share common code

  Modified files:
    test/test-file-content.rb

  Modified: test/test-file-content.rb (+8 -10)
===================================================================
--- test/test-file-content.rb    2014-01-04 18:56:26 +0900 (d59b233)
+++ test/test-file-content.rb    2014-01-04 19:03:31 +0900 (3391339)
@@ -24,29 +24,27 @@ class TestFileContent < Test::Unit::TestCase
     @file.flush
   end
 
+  def content(string=nil)
+    write(string) if string
+    ChupaText::FileContent.new(@file.path)
+  end
+
   def test_size
     body = "Hello"
-    write(body)
-    content = ChupaText::FileContent.new(@file.path)
-    assert_equal(body.bytesize, content.size)
+    assert_equal(body.bytesize, content(body).size)
   end
 
   def test_path
-    content = ChupaText::FileContent.new(@file.path)
     assert_equal(@file.path, content.path)
   end
 
   def test_body
     body = "Hello"
-    write(body)
-    content = ChupaText::FileContent.new(@file.path)
-    assert_equal(body, content.body)
+    assert_equal(body, content(body).body)
   end
 
   def test_open
     body = "Hello"
-    write(body)
-    content = ChupaText::FileContent.new(@file.path)
-    assert_equal(body, content.open {|file| file.read})
+    assert_equal(body, content(body).open {|file| file.read})
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index