diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-09 22:38:26 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-09 22:38:26 +0900 |
commit | 223addb898938dec5cd5196f7ad9f0b3aca17a99 (patch) | |
tree | 3bbdef6be91abf3d35afe34305886508b94c8034 /test/utils | |
parent | e44ecc10fe65ae0a3b5887e1bfcbf16a9acc152f (diff) | |
download | plum-223addb898938dec5cd5196f7ad9f0b3aca17a99.tar.gz |
tests: add test cases for Client
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/string_socket.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/utils/string_socket.rb b/test/utils/string_socket.rb index fb59172..0cffa64 100644 --- a/test/utils/string_socket.rb +++ b/test/utils/string_socket.rb @@ -1,12 +1,15 @@ -class StringSocket +class StringSocket < IO + # remove all methods + (IO.instance_methods - Object.instance_methods).each { |symbol| undef_method symbol } + extend Forwardable def_delegators :@rio, :readpartial def_delegators :@wio, :<<, :write attr_reader :rio, :wio - def initialize(str) - @rio = StringIO.new(str) + def initialize(str = nil) + @rio = StringIO.new(str.to_s) @wio = StringIO.new end end |