Mock/stub method from a class in /lib (MiniTest)

I’m writing a test for a GraphQL query. The query calls a method from lib/neo4j_queries.rb which connects to a Neo4j server and runs a query there. There’s no Neo4j server available in the test environment but I do have a JSON file of the expected response and would like to test that the GraphQL query parses this correctly and returns the required information. The test looks like this:


class GetNeo4jTest < ActiveSupport::TestCase

  require "#{Rails.root}/app/graphql/my_schema.rb"

  test 'get data from neo4j' do

    f = File.open("#{Rails.root}/test/fixtures/files/neo4j_data.json", "r") 
    json_data = f.read

    # TODO: Somehow json_data needs to be returned from the getneo4j query, below.

    query_string = %Q{
      query {
        getNeo4j(id: 1236) {
          id
          name
        }
      }
    }

    res = MySchema.execute(
      query_string
    )

    data = res.to_h['data']['getNeo4j']
    puts data
    assert_equal data.length, 10
    f.close
  end

The query itself contains some GraphQL boilerplate, but it essentially calls a get_neo4j_data(id) method from lib/neo4j_queries.rb.

module Queries
  class GetNeo4j < Queries::BaseQuery
    include Neo4jQueries
    description 'Get all records which are part_of the id supplied'

    argument :id, Integer, "unique ID of the top level record", required: true

    type [Types::RecordType], null: false

    def resolve(id:)
      raw = get_fairassist_components(id, true).with_indifferent_access  # This comes from Neo4jQueries and is what needs mocking
      ids = get_ids_from_raw_data(raw)
      

      ::Record.find(ids)
    end
  end
end

This query makes an http query to the Neo4j server which returns complex data in need of parsing (done in the GraphQL getNeo4j query).

Is there any means to mock this in the test above, given the relations of the components?