Sha256: c82197d5ecfb173e5e271ba1f6aa044545cd5ff124647f43ec45f12035c2d466

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

require 'test_helper'
require 'tins/xt/temp_io'

module Tins
  class TempIOTest < Test::Unit::TestCase
    def test_with_string
      returned = temp_io('foo') { |io|
        assert_equal 'foo', io.read
        :done
      }
      assert_equal returned, :done
    end

    def test_with_proc
      returned = temp_io(-> { 'foo' }) { |io|
        assert_equal 'foo', io.read
        :done
      }
      assert_equal returned, :done
    end

    def test_with_proc_and_io_arg
      returned = temp_io(-> io { io << 'foo' }) { |io|
        assert_equal 'foo', io.read
        :done
      }
      assert_equal returned, :done
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tins-1.16.1 tests/temp_io_test.rb