Sha256: 184f866cf73ad35794f86bf552d83a522aeeaf356db3bc3836fc5e3f9397ffd0

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

require 'test_helper'
require 'lotus/utils/io'

class IOTest
  TEST_CONSTANT = 'initial'
end

describe Lotus::Utils::IO do
  describe '.silence_warnings' do
    it 'lowers verbosity of stdout' do
      begin
        position = STDOUT.tell

        Lotus::Utils::IO.silence_warnings do
          IOTest::TEST_CONSTANT = 'redefined'
        end

        IOTest::TEST_CONSTANT.must_equal('redefined')
        STDOUT.tell.must_equal(position)
      rescue Errno::ESPIPE
        puts 'Skipping this test, IO#tell is not supported in this environment'

        Lotus::Utils::IO.silence_warnings do
          IOTest::TEST_CONSTANT = 'redefined'
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lotus-utils-0.1.1 test/io_test.rb
lotus-utils-0.1.0 test/io_test.rb