<commit_before>require 'spec_helper'

describe MSFL::Visitors::ChewyTermFilter do

  let(:collector) { Array.new }

  let(:node) { fail ArgumentError, "You must define the node variable in each scope." }

  let(:test_instance) { described_class.new }

  describe "#visit_MSFL_Nodes_Date" do

    subject { test_instance.visit_MSFL_Nodes_Date node, collector }

    let(:node) { MSFL::Nodes::Date.new Date.today }

    it "is today's date using iso8601 formatting" do
      expect(subject.first).to eq Date.today.iso8601
    end
  end

  describe "#visit_MSFL_Nodes_DateTime" do

    subject { test_instance.visit_MSFL_Nodes_DateTime node, collector }

    let(:now) { DateTime.now }

    let(:node) { MSFL::Nodes::DateTime.new now }

    it "is the current date and time using iso8601 formatting" do
      expect(subject.first).to eq now.iso8601
    end
  end

  describe "#visit_MSFL_Nodes_Number" do

    subject { test_instance.visit_MSFL_Nodes_Number node, collector }

    let(:node) { MSFL::Nodes::Number.new number }

    let(:number) { 123 }

    it "is the number" do
      expect(subject.first).to eq number
    end

    context "when the number is a float" do

      let(:number) { 123.456 }

      it "is the number with the same precision" do
        expect(subject.first).to eq number
      end
    end
  end

  describe "#visit_MSFL_Nodes_Time" do

    subject { test_instance.visit_MSFL_Nodes_Time node, collector }

    let(:node) { MSFL::Nodes::Time.new current_time }

    let(:current_time) { Time.now }

    it "is the current time using iso8601 formatting" do
      expect(subject.first).to eq current_time.iso8601
    end<commit_msg>Updated visit_range_value_spec examples to conform to new convention for testing visit_ methods<commit_after>require 'spec_helper'

describe MSFL::Visitors::ChewyTermFilter do

  subject { node.accept visitor }

  let(:node) { fail ArgumentError, "You must define the node variable in each scope." }

  let(:visitor) { described_class.new collector }

  let(:collector) { Array.new }

  describe "visiting a Date node" do

    let(:node) { MSFL::Nodes::Date.new Date.today }

    it "is today's date using iso8601 formatting" do
      expect(subject.first).to eq Date.today.iso8601
    end
  end

  describe "visiting a DateTime node" do

    let(:now) { DateTime.now }

    let(:node) { MSFL::Nodes::DateTime.new now }

    it "is the current date and time using iso8601 formatting" do
      expect(subject.first).to eq now.iso8601
    end
  end

  describe "visiting a Number node" do

    let(:node) { MSFL::Nodes::Number.new number }

    let(:number) { 123 }

    it "is the number" do
      expect(subject.first).to eq number
    end

    context "when the number is a float" do

      let(:number) { 123.456 }

      it "is the number with the same precision" do
        expect(subject.first).to eq number
      end
    end
  end

  describe "visiting a Time node" do

    let(:node) { MSFL::Nodes::Time.new current_time }

    let(:current_time) { Time.now }

    it "is the current time using iso8601 formatting" do
      expect(subject.first).to eq current_time.iso8601
    end
{'fraction_non_alphanumeric': 0.0957683741648107, 'fraction_numerical': 0.020999045497931912, 'mean_word_length': 3.2032085561497325, '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': '4667108', 'n_tokens_mistral': 1068, 'n_tokens_neox': 953, 'n_words': 296}