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: test_gem_package_tar_writer.rb
    path of file: ./repos/truffleruby/test/mri/tests/rubygems
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
require_relative "package/tar_test_case"
require "rubygems/package/tar_writer"

class TestGemPackageTa
    
  def test_add_file
    Time.stub :now, Time.at(1458518157) do
      @tar_writer.add_file "x", 0644 do |f|
        f.write "a" * 10
      end

      assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
                         @io.string[0, 512])
    end
    assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
    assert_equal 1024, @io.pos
  end