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: wal_tracking_shared_context.rb
    path of file: ./repos/gitlabhq/spec/support/shared_contexts/lib/gitlab/database/load_balancing
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

RSpec.shared_context 'when 
    
  def expect_tracked_locations_when_no_replicas_available
    {}.tap do |locations|
      Gitlab::Database::LoadBalancing.each_load_balancer do |lb|
        expect(lb).to receive(:host).at_least(:once).and_return(nil)
        expect(lb).to receive(:primary_write_location).and_return(current_location)

        locations[lb.name] = current_location
      end
    end
  end