Sha256: 5c5c3f706dce58088101ddab3170db3b6c607e23923a5d93c48974a13b4d5e36

Contents?: true

Size: 811 Bytes

Versions: 20

Compression:

Stored size: 811 Bytes

Contents

require_relative '../../spec_helper'
require_lib 'reek/cli/silencer'

RSpec.describe Reek::CLI::Silencer do
  describe '.silently' do
    it 'blocks output from the block on $stdout' do
      expect { described_class.silently { puts 'Hi!' } }.not_to output.to_stdout
    end

    it 'blocks output from the block on $stderr' do
      expect { described_class.silently { warn 'Hi!' } }.not_to output.to_stderr
    end

    it 'restores output on $stdout after the block' do
      expect do
        described_class.silently { puts 'Hi!' }
        puts 'there!'
      end.to output("there!\n").to_stdout
    end

    it 'restores output on $stderr after the block' do
      expect do
        described_class.silently { warn 'Hi!' }
        warn 'there!'
      end.to output("there!\n").to_stderr
    end
  end
end

Version data entries

20 entries across 18 versions & 2 rubygems

Version Path
reek-6.0.3 spec/reek/cli/silencer_spec.rb
reek-6.0.2 spec/reek/cli/silencer_spec.rb
reek-6.0.1 spec/reek/cli/silencer_spec.rb
reek-6.0.0 spec/reek/cli/silencer_spec.rb
reek-5.6.0 spec/reek/cli/silencer_spec.rb
reek-5.5.0 spec/reek/cli/silencer_spec.rb
reek-5.4.1 spec/reek/cli/silencer_spec.rb
reek-5.4.0 spec/reek/cli/silencer_spec.rb
reek-5.3.2 spec/reek/cli/silencer_spec.rb
reek-5.3.1 spec/reek/cli/silencer_spec.rb
reek-5.3.0 spec/reek/cli/silencer_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/silencer_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/silencer_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/silencer_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/silencer_spec.rb
reek-5.2.0 spec/reek/cli/silencer_spec.rb
reek-5.1.0 spec/reek/cli/silencer_spec.rb
reek-5.0.2 spec/reek/cli/silencer_spec.rb
reek-5.0.1 spec/reek/cli/silencer_spec.rb
reek-5.0.0 spec/reek/cli/silencer_spec.rb