<commit_before>require_relative '../message_handler.rb'
require_relative '../distance_calculator.rb'

describe ".MessageHandler" do
	let(:message) { "!distance 32084 04101" }
	let(:any_old_message) { "lorem ipsum" }
	let(:locations) { ["32084", "04101"] }
	let(:distance) { 1130 }
	let(:handler) { MessageHandler.new(message) }
	let(:second_handler) { MessageHandler.new(any_old_message) }
	context "when message is received with distance command" do
		it "finds distance command in message" do
			expect(handler.has_command?).to eq(true)
		end

		it "finds locations in message" do
			expect(handler.get_locations).to eq(locations)
		end

		it "uses DistanceCalculator object to calculate distance between objects" do
			expect(handler.distance_calculator).to be_within(5).of(distance)<commit_msg>Adds test for has_km? in MessageHandler<commit_after>require_relative '../message_handler.rb'
require_relative '../distance_calculator.rb'

describe ".MessageHandler" do
	let(:message) { "!distance 32084 04101 km" }
	let(:any_old_message) { "lorem ipsum" }
	let(:locations) { ["32084", "04101"] }
	let(:distance) { 1130 }
	let(:handler) { MessageHandler.new(message) }
	let(:second_handler) { MessageHandler.new(any_old_message) }
	context "when message is received with distance command" do
		it "finds distance command in message" do
			expect(handler.has_command?).to eq(true)
		end

		it "finds locations in message" do
			expect(handler.get_locations).to eq(locations)
		end

		it "uses DistanceCalculator object to calculate distance between objects" do
			expect(handler.distance_calculator).to be_within(5).of(distance)
		end

		it "finds kilometers parameter in message" do
			expect(handler.has_km?).to eq(true)
{'fraction_non_alphanumeric': 0.11751018033740547, 'fraction_numerical': 0.029086678301337987, 'mean_word_length': 5.394052044609666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 2, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4018747', 'n_tokens_mistral': 617, 'n_tokens_neox': 530, 'n_words': 141}