```ruby
# coding: utf-8

shared_context 'silence output', silence_output: true do
  before do
    null_output = double('output').as_null_object

    @original_stdout = $stdout
    @original_stderr = $stderr

    $stdout = null_output
    $stderr = null_output
  end

  after do
    $stdout = @original_stdout
    $stderr = @original_stderr
  end
end
```

Use a custom null object in the silence output context
user
```ruby
# coding: utf-8

shared_context 'silence output', silence_output: true do
  null_object = BasicObject.new

  class << null_object
    # #respond_to_missing? does not work.
    def respond_to?(*)
      true
    end

    def method_missing(*)
    end
  end

  before do
    @original_stdout = $stdout
    @original_stderr = $stderr
    $stdout = null_object
    $stderr = null_object
  end

  after do
    $stdout = @original_stdout
    $stderr = @original_stderr
  end
end
```
assistant