require "agentdb"
RSpec.configure do |config|
config.formatter = :documentation
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
config.order = :random
Kernel.srand config.seed
def with_db
db = AgentDB::Database.new(":memory:")
yield db
ensure
db&.close
end
def random_embedding(dim = 4)
raw = Array.new(dim) { rand(-1.0..1.0) }
mag = Math.sqrt(raw.sum { |x| x**2 })
mag > 0 ? raw.map { |x| x / mag } : raw
end
end