<commit_before># frozen_string_literal: true

require 'spec_helper'

include Pocus::Fixtures

RSpec.describe Pocus::CustomField do
  Pocus::Session.config(fixtures(:credentials))
  Pocus::Session.instance.logger = Logger.new(STDOUT) if ENV['POCUS_DEBUG']
  let(:account) { Pocus::Account.new(account_id: fixtures(:account_id)) }
  let(:test_folder) { account.clientfolders.find(fixtures(:test_client_folder_id)) }

  describe '#custom_fields.create' do
    it 'creates custom fields' do
      birthdate_fields = {
        custom_field_id: :birthdate,
        field_type: :date,
        display_to_user: 1
      }
      custom_field = test_folder.customfields.create(birthdate_fields)
      expect(custom_field).to be_a(Pocus::CustomField)
      expect(custom_field.errors).to be_empty
      expect(custom_field.warnings).to be_empty
    end
  end
end<commit_msg>Use a unique privateName when creating a test custom field instead of providing an ID.<commit_after># frozen_string_literal: true

require 'spec_helper'

include Pocus::Fixtures

RSpec.describe Pocus::CustomField do
  Pocus::Session.config(fixtures(:credentials))
  Pocus::Session.instance.logger = Logger.new(STDOUT) if ENV['POCUS_DEBUG']
  let(:account) { Pocus::Account.new(account_id: fixtures(:account_id)) }
  let(:test_folder) { account.clientfolders.find(fixtures(:test_client_folder_id)) }

  describe '#custom_fields.create' do
    it 'creates custom fields' do
      birthdate_fields = {
        private_name: rand.to_s,
        field_type: :date,
        display_to_user: 1
      }
      custom_field = test_folder.customfields.create(birthdate_fields)
      expect(custom_field).to be_a(Pocus::CustomField)
      expect(custom_field.errors).to be_empty
      expect(custom_field.warnings).to be_empty
      custom_field.destroy
    end
  end
end
{'fraction_non_alphanumeric': 0.1043956043956044, 'fraction_numerical': 0.001098901098901099, 'mean_word_length': 4.468468468468468, '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': '1866495', 'n_tokens_mistral': 594, 'n_tokens_neox': 580, 'n_words': 106}