<commit_before>require 'spec_helper'

include LocationsHelper

describe LocationsHelper do
  describe "#route_duration_and_distance" do

    
    context "waypoints are not given" do
      it "should return the duration in minutes and the distance in km between origin and destination" do
        results = LocationsHelper.route_duration_and_distance("Otakaari 20", "Kaironkatu 2")
        results.should be_an_instance_of(Array)
        results[0].should be_close(22, 0.5)
        results[1].should be_close(12.5, 0.2)
      end
    end
    
    context "waypoints are given" do
      it "should return the sum of durations and distances when whole route is traveled." do
        results = LocationsHelper.route_duration_and_distance("Otakaari 20", "Kaironkatu2", ["ruoholahti,helsinki", "hakaniemen tori,helsinki"])
        #results.should == [29,16.6]
        results.should be_an_instance_of(Array)
        results[0].should be_close(30, 0.5)
        results[1].should be_close(16.6, 0.2)
      end
      
    end
    
  end
  
end<commit_msg>Minor fix to location route calculations test, that started failing recently.<commit_after>require 'spec_helper'

include LocationsHelper

describe LocationsHelper do
  describe "#route_duration_and_distance" do

    
    context "waypoints are not given" do
      it "should return the duration in minutes and the distance in km between origin and destination" do
        results = LocationsHelper.route_duration_and_distance("Otakaari 20", "Kaironkatu 2")
        results.should be_an_instance_of(Array)
        results[0].should be_close(22, 0.5)
        results[1].should be_close(12.5, 0.2)
      end
    end
    
    context "waypoints are given" do
      it "should return the sum of durations and distances when whole route is traveled." do
        results = LocationsHelper.route_duration_and_distance("Otakaari 20", "Kaironkatu 2", ["ruoholahti,helsinki", "hakaniemen tori,helsinki"])
        puts results
        #results.should == [29,16.6]
        results.should be_an_instance_of(Array)
        results[0].should be_close(30, 0.5)
        results[1].should be_close(16.6, 0.2)
      end
      
    end
    
  end
  
end
{'fraction_non_alphanumeric': 0.08256880733944955, 'fraction_numerical': 0.030275229357798167, 'mean_word_length': 3.138519924098672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, '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': '6423108', 'n_tokens_mistral': 714, 'n_tokens_neox': 665, 'n_words': 190}