<commit_before><commit_msg>Added a test that checks both the local and remote data source for valid holiday definitions.<commit_after>require 'spec_helper'

describe 'Bank holidays' do
  describe 'bundled database' do
    subject do
      JSON.parse(File.read('config/bank-holidays.json'))['england-and-wales']['events']
    end

    it 'contains at least one bank holiday after today' do
      subject.map do |entry|
        Date.parse(entry['date'])
      end.find do |date|
        date > Date.today
      end.should_not be_nil
    end
  end

  describe 'remote data source' do
    subject do
      JSON.parse(Curl::Easy.perform('https://www.gov.uk/bank-holidays.json').body_str)
    end

    it 'contains a list of holidays' do
      first_entry = subject['england-and-wales']['events'].first
      first_entry.keys.to_set > Set['bunting', 'date', 'notes', 'title']
    end
  end
end
{'fraction_non_alphanumeric': 0.1161217587373168, 'fraction_numerical': 0.0, 'mean_word_length': 3.2085308056872037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '2965714', 'n_tokens_mistral': 274, 'n_tokens_neox': 269, 'n_words': 78}