<commit_before># frozen_string_literal: true

require 'spec_helper'

describe 'Last Modified At Tag' do
  context 'A committed post file' do
    def setup(file, layout)
      @post = setup_post(file)
      do_render(@post, layout)
    end

    it 'has last revised date' do
      setup('1984-03-06-last-modified-at.md', 'last_modified_at.html')
      expect(@post.output).to match(/Article last updated on 03-Jan-14/)
    end

    it 'passes along last revised date format' do
      setup('1984-03-06-last-modified-at-with-format.md', 'last_modified_at_with_format.html')
      expect(@post.output).to match(/Article last updated on 2014:January:Saturday:04/)
    end

    it 'ignores files that do not exist' do
      expect { setup('1984-03-06-what-the-eff.md', 'last_modified_at_with_format.html') }.to_not raise_error
    end

    it 'does not run arbitrary commands' do
      setup('1984-03-06-command.md|whoami>.gitkeep', 'last_modified_at_with_format.html')
      expect(File.exist?('.bogus')).to be false
    end
  end

  context 'An uncommitted post file' do
    before(:all) do
      cheater_file = '1984-03-06-last-modified-at.md'
      uncommitted_file = '1992-09-11-last-modified-at.md'
      duplicate_post(cheater_file, uncommitted_file)
      @post = setup_post(uncommitted_file)
      do_render(@post, 'last_modified_at.html')
    end

    it 'has last revised date' do
      expect(@post.output).to match(Regexp.new("Article last updated on #{Time.new.strftime('%d-%b-%y')}"))
    end
  end
end<commit_msg>Fix time in tests not being in UTC<commit_after># frozen_string_literal: true

require 'spec_helper'

describe 'Last Modified At Tag' do
  context 'A committed post file' do
    def setup(file, layout)
      @post = setup_post(file)
      do_render(@post, layout)
    end

    it 'has last revised date' do
      setup('1984-03-06-last-modified-at.md', 'last_modified_at.html')
      expect(@post.output).to match(/Article last updated on 03-Jan-14/)
    end

    it 'passes along last revised date format' do
      setup('1984-03-06-last-modified-at-with-format.md', 'last_modified_at_with_format.html')
      expect(@post.output).to match(/Article last updated on 2014:January:Saturday:04/)
    end

    it 'ignores files that do not exist' do
      expect { setup('1984-03-06-what-the-eff.md', 'last_modified_at_with_format.html') }.to_not raise_error
    end

    it 'does not run arbitrary commands' do
      setup('1984-03-06-command.md|whoami>.gitkeep', 'last_modified_at_with_format.html')
      expect(File.exist?('.bogus')).to be false
    end
  end

  context 'An uncommitted post file' do
    before(:all) do
      cheater_file = '1984-03-06-last-modified-at.md'
      uncommitted_file = '1992-09-11-last-modified-at.md'
      duplicate_post(cheater_file, uncommitted_file)
      @post = setup_post(uncommitted_file)
      do_render(@post, 'last_modified_at.html')
    end

    it 'has last revised date' do
      expect(@post.output).to match(Regexp.new("Article last updated on #{Time.new.utc.strftime('%d-%b-%y')}"))
    end
  end
end
{'fraction_non_alphanumeric': 0.12398307842499186, 'fraction_numerical': 0.03774812886430198, 'mean_word_length': 3.3602836879432623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5270493', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1026, 'n_words': 244}