You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ui_driver.rb
    path of file: ./repos/metasploit-framework/spec/support/shared/contexts/msf
    
    the code of the file until where you have to start completion: RSpec.shared_context 'Msf::UIDriver' do
  let(:driver) do
    instance = double('Driver', framework: framework)
    allow(instance).to receive(:on_command_proc=).with(kind_of(Proc))
    capture_logging(instance)
    insta
    
  def capture_logging(target)
    append_output = proc do |string = ''|
      lines = string.split("\n")
      @output ||= []
      @output.concat(lines)
      @combined_output ||= []
      @combined_output.concat(lines)
    end
    append_error = proc do |string = ''|
      lines = string.split("\n")
      @error ||= []
      @error.concat(lines)
      @combined_output ||= []
      @combined_output.concat(lines)
    end

    allow(target).to receive(:print, &append_output)
    allow(target).to receive(:print_line, &append_output)
    allow(target).to receive(:print_status, &append_output)
    allow(target).to receive(:print_good, &append_output)

    allow(target).to receive(:print_warning, &append_error)
    allow(target).to receive(:print_error, &append_error)
    allow(target).to receive(:print_bad, &append_error)
  end