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

require 'spec_helper'

RSpec.describe ::Gitlab::Ci::Pipeline::Logger, feature_category: :continuous_integration do
  let_it_be(:project) { build_stubbed(:project) }
  let_it_be(:pipeline) { build_stubbed(:ci_pipeline, project: project) }

  subject(:logger) { described_class.new(project: project) }

  describe '#log_when' do
    it 'stores blocks for later evalua
    
    def expected_data(count:, db_count: nil)
      database_name = Ci::ApplicationRecord.connection.pool.db_config.name

      total_db_count = count * db_count if db_count

      {
        "expensive_operation_duration_s" => a_kind_of(Numeric),
        "expensive_operation_db_count" => total_db_count || a_kind_of(Numeric),
        "expensive_operation_db_primary_count" => a_kind_of(Numeric),
        "expensive_operation_db_primary_duration_s" => a_kind_of(Numeric),
        "expensive_operation_db_#{database_name}_count" => a_kind_of(Numeric),
        "expensive_operation_db_#{database_name}_duration_s" => a_kind_of(Numeric)
      }
    end