<commit_before>require 'rails_helper'
require File.dirname(__FILE__) + '/date_validation_helpers'

describe FeeValidator do

  include RspecDateValidationHelpers

  let(:claim)                     { FactoryGirl.build :claim, force_validation: true }
  let(:fee)                       { FactoryGirl.build :fee, claim: claim }
  let(:baf_fee)                   { FactoryGirl.build :fee, :baf_fee, claim: claim }
  let(:daf_fee)                   { FactoryGirl.build :fee, :daf_fee, claim: claim }
  let(:dah_fee)                   { FactoryGirl.build :fee, :dah_fee, claim: claim }
  let(:daj_fee)                   { FactoryGirl.build :fee, :daj_fee, claim: claim }
  let(:pcm_fee)                   { FactoryGirl.build :fee, :pcm_fee, claim: claim }

  describe 'fee type' do
    it { should_error_if_not_present(fee, :fee_type, 'Fee type cannot be blank') }
  end


  describe 'amount' do
    before(:each) do
      daf_fee.claim.actual_trial_length = 10
    end
    context 'quantity greater than zero' do
      it { should_be_valid_if_equal_to_value(daf_fee, :amount, 450.00) }
      it { should_error_if_equal_to_value(daf_fee, :amount, nil, 'Fee amount cannot be zero or blank if a fee quantity has been specified, please enter the relevant amount') }
      it { should_error_if_equal_to_value(daf_fee, :amount, 0.00, 'Fee amount cannot be zero or blank if a fee quantity has been specified, please enter the relevant amount') }
      it { should_error_if_equal_to_value(daf_fee, :amount, -320, 'Fee amount cannot be negative') }
      it { should_error_if_equal_to_value(daf_fee, :amount, 250.44, 'Fee amount must be whole numbers only') }
    end

    context 'quantity = 0' do
      before(:each) do
        daf_fee.quantity = 0
      end
      it { should_error_if_equal_to_value(daf_fee, :amount, 1.00, 'Fee amounts cannot be specified if the fee quanitity is zero') }
    end

    context 'fee with max amount' do
      before(:each)       { fee.fee_type.max_amount = 9999 }<commit_msg>fix spec for related to previous copy change<commit_after>require 'rails_helper'
require File.dirname(__FILE__) + '/date_validation_helpers'

describe FeeValidator do

  include RspecDateValidationHelpers

  let(:claim)                     { FactoryGirl.build :claim, force_validation: true }
  let(:fee)                       { FactoryGirl.build :fee, claim: claim }
  let(:baf_fee)                   { FactoryGirl.build :fee, :baf_fee, claim: claim }
  let(:daf_fee)                   { FactoryGirl.build :fee, :daf_fee, claim: claim }
  let(:dah_fee)                   { FactoryGirl.build :fee, :dah_fee, claim: claim }
  let(:daj_fee)                   { FactoryGirl.build :fee, :daj_fee, claim: claim }
  let(:pcm_fee)                   { FactoryGirl.build :fee, :pcm_fee, claim: claim }

  describe 'fee type' do
    it { should_error_if_not_present(fee, :fee_type, 'Fee type cannot be blank') }
  end


  describe 'amount' do
    before(:each) do
      daf_fee.claim.actual_trial_length = 10
    end
    context 'quantity greater than zero' do
      it { should_be_valid_if_equal_to_value(daf_fee, :amount, 450.00) }
      it { should_error_if_equal_to_value(daf_fee, :amount, nil, 'Fee amount cannot be zero or blank if a fee quantity has been specified, please enter the relevant amount') }
      it { should_error_if_equal_to_value(daf_fee, :amount, 0.00, 'Fee amount cannot be zero or blank if a fee quantity has been specified, please enter the relevant amount') }
      it { should_error_if_equal_to_value(daf_fee, :amount, -320, 'Fee amount cannot be negative') }
      it { should_error_if_equal_to_value(daf_fee, :amount, 250.44, 'Fee amount must be whole numbers only') }
    end

    context 'quantity = 0' do
      before(:each) do
        daf_fee.quantity = 0
      end
      it { should_error_if_equal_to_value(daf_fee, :amount, 1.00, 'Fee amounts cannot be specified if the fee quantity is zero') }
    end

    context 'fee with max amount' do
      before(:each)       { fee.fee_type.max_amount = 9999 }
{'fraction_non_alphanumeric': 0.09343936381709742, 'fraction_numerical': 0.01341948310139165, 'mean_word_length': 2.9694280078895465, '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': '2872661', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1262, 'n_words': 381}