Sha256: e12a80d05e4aa71303d860cead3b6a8908e1dc971bc2fc6b23cd9a408589666c

Contents?: true

Size: 804 Bytes

Versions: 13

Compression:

Stored size: 804 Bytes

Contents

require_relative 'test_helper'

class FileWriterTest < Minitest::Test
  describe IOStreams::File::Writer do
    let :file_name do
      File.join(File.dirname(__FILE__), 'files', 'text.txt')
    end

    let :raw do
      File.read(file_name)
    end

    describe '.open' do
      it 'file' do
        temp_file = Tempfile.new('rocket_job')
        file_name = temp_file.to_path
        IOStreams::File::Writer.open(file_name) do |io|
          io.write(raw)
        end
        result = File.read(file_name)
        assert_equal raw, result
      end

      it 'does not support streams' do
        io_string = StringIO.new
        assert_raises ArgumentError do
          IOStreams::File::Writer.open(io_string) do |io|
            io.write(raw)
          end
        end
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iostreams-0.20.2 test/file_writer_test.rb
iostreams-0.20.1 test/file_writer_test.rb
iostreams-0.20.0 test/file_writer_test.rb
iostreams-0.19.0 test/file_writer_test.rb
iostreams-0.18.0 test/file_writer_test.rb
iostreams-0.17.3 test/file_writer_test.rb
iostreams-0.17.2 test/file_writer_test.rb
iostreams-0.17.1 test/file_writer_test.rb
iostreams-0.17.0 test/file_writer_test.rb
iostreams-0.16.2 test/file_writer_test.rb
iostreams-0.16.1 test/file_writer_test.rb
iostreams-0.16.0 test/file_writer_test.rb
iostreams-0.15.0 test/file_writer_test.rb