<commit_before>require 'minitest/autorun'
require 'yaml'
require 'json'
require './lib/lonelyplanet_scrap'

tours_from_file = YAML.load(File.read('./spec/tours.yml'))

describe 'Compare returned results against actual data' do

  before do
    data = LonelyPlanetScrape::LonelyPlanetTours.new.tours
    @tours_found = JSON.parse(data)
  end

  # May not be necessary if we choose to check the yaml test file against the results
  it 'has the right number of tours' do
    @tours_found.size.must_equal tours_from_file.size
  end

  it 'should contain current tour details' do
    diff = `diff tours_from_file @tours_found.to_yaml`
    diff.must_equal ''
  end
end<commit_msg>Revised specs<commit_after>require 'minitest/autorun'
require 'yaml'
require 'json'
require './lib/lonelyplanet_scrap'

tours_from_file = YAML.load(File.read('./spec/tours.yml'))
data = LonelyPlanetScrape::LonelyPlanetTours.new.tours
tours_found = JSON.parse(data)

describe 'Compare returned results against actual data' do

  it 'check if the number of taiwan tours has changed' do
    tours_found.size.must_equal tours_from_file.size
  end

  it 'check for changes in structure of results' do
    tours_found[0].key?('price').must_equal true
    tours_found[0].key?('title').must_equal true
    tours_found[0].key?('content').must_equal true
  end

  0.upto(tours_from_file.length - 1) do |index|
    it 'check for price changes' do
      tours_from_file[index]['price'].must_equal tours_found[index]['price']
    end

    it 'check for title changes' do
      tours_from_file[index]['title'].must_equal tours_found[index]['title']
    end

    it 'check for description changes' do
      tours_from_file[index]['content'].must_equal tours_found[index]['content']
    end
  end
  
end
{'fraction_non_alphanumeric': 0.1033503691084611, 'fraction_numerical': 0.0028392958546280523, 'mean_word_length': 4.404907975460123, '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': '1328435', 'n_tokens_mistral': 597, 'n_tokens_neox': 583, 'n_words': 151}