<commit_before>require "spec_helper"

# Anodator::Validator::LengthValidator
require "anodator/validator/length_validator"

include Anodator::Validator

RSpec.describe LengthValidator, ".new" do
  context "with no paramerters" do
    it "should raise error" do
      expect {
        LengthValidator.new()
      }.to raise_error
    end
  end

  context "with only target expression" do
    it "should not raise error" do
      expect {
        LengthValidator.new("1")
      }.not_to raise_error
    end
  end

  context "with target expression and :maximum parameters" do
    before(:each) do
      @new_proc = lambda {
        LengthValidator.new("1", :maximum => 10)
      }
    end

    it "should not raise error" do
      expect(@new_proc).not_to raise_error
    end

    it "should have :maximum option value" do
      validator = @new_proc.call
      expect(validator.options[:maximum].value).to be == 10
    end
  end

  context "with target expression and :minimum parameters" do
    before(:each) do<commit_msg>Add error class on length_validator<commit_after>require "spec_helper"

# Anodator::Validator::LengthValidator
require "anodator/validator/length_validator"

include Anodator::Validator

RSpec.describe LengthValidator, ".new" do
  context "with no paramerters" do
    it "should raise error" do
      expect {
        LengthValidator.new()
      }.to raise_error ArgumentError
    end
  end

  context "with only target expression" do
    it "should not raise error" do
      expect {
        LengthValidator.new("1")
      }.not_to raise_error
    end
  end

  context "with target expression and :maximum parameters" do
    before(:each) do
      @new_proc = lambda {
        LengthValidator.new("1", :maximum => 10)
      }
    end

    it "should not raise error" do
      expect(@new_proc).not_to raise_error
    end

    it "should have :maximum option value" do
      validator = @new_proc.call
      expect(validator.options[:maximum].value).to be == 10
    end
  end

  context "with target expression and :minimum parameters" do
    before(:each) do
{'fraction_non_alphanumeric': 0.08645533141210375, 'fraction_numerical': 0.005763688760806916, 'mean_word_length': 2.9600760456273765, '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': '3947683', 'n_tokens_mistral': 627, 'n_tokens_neox': 599, 'n_words': 192}