<commit_before>require 'test_helper'

class PatientTest < ActiveSupport::TestCase
  before do
    @user = create :user
    @patient = create :patient, created_by: @user
  end

  describe 'validations' do
    it 'can be valid' do
      assert @patient.valid?
    end

    it 'requires a name' do
      @patient.name = nil
      refute @patient.valid?
    end

    it 'requires a primary phone' do
      @patient.primary_phone = nil
      refute @patient.valid?
    end

    it 'requires a logged creating user' do
      @patient.created_by_id = nil
      refute @patient.valid?
    end
  end

  # describe 'callbacks' do
  #   %w(name secondary_person).each do |field|
  #     it 'should strip whitespace from before and after name' do
  #     end
  #   end

  #   %w(primary_phone secondary_phone).each do |field|
  #     it 'should enforce phone length' do
  #     end
  #   end
  # end

  describe 'relationships' do
    it 'should have at least one associated pregnancy' do
    end

    it 'should have only one active pregnancy' do
    end
  end

  describe 'mongoid attachments' do
    it 'should have timestamps from Mongoid::Timestamps' do
      [:created_at, :updated_at].each do |field|
        assert @patient.respond_to? field
        assert @patient[field]
      end
    end

    it 'should respond to history methods' do
      assert @patient.respond_to? :history_tracks
      assert @patient.history_tracks.count > 0
    end

    it 'should have accessible userstamp methods' do
      assert @patient.respond_to? :created_by
      assert @patient.created_by
    end<commit_msg>stub relationship tests for now<commit_after>require 'test_helper'

class PatientTest < ActiveSupport::TestCase
  before do
    @user = create :user
    @patient = create :patient, created_by: @user
  end

  describe 'validations' do
    it 'can be valid' do
      assert @patient.valid?
    end

    it 'requires a name' do
      @patient.name = nil
      refute @patient.valid?
    end

    it 'requires a primary phone' do
      @patient.primary_phone = nil
      refute @patient.valid?
    end

    it 'requires a logged creating user' do
      @patient.created_by_id = nil
      refute @patient.valid?
    end
  end

  # describe 'callbacks' do
  #   %w(name secondary_person).each do |field|
  #     it 'should strip whitespace from before and after name' do
  #     end
  #   end

  #   %w(primary_phone secondary_phone).each do |field|
  #     it 'should enforce phone length' do
  #     end
  #   end
  # end

  # describe 'relationships' do
  #   it 'should have at least one associated pregnancy' do
  #   end

  #   it 'should have only one active pregnancy' do
  #   end
  # end

  describe 'mongoid attachments' do
    it 'should have timestamps from Mongoid::Timestamps' do
      [:created_at, :updated_at].each do |field|
        assert @patient.respond_to? field
        assert @patient[field]
      end
    end

    it 'should respond to history methods' do
      assert @patient.respond_to? :history_tracks
      assert @patient.history_tracks.count > 0
    end

    it 'should have accessible userstamp methods' do
      assert @patient.respond_to? :created_by
      assert @patient.created_by
    end
{'fraction_non_alphanumeric': 0.07658779576587796, 'fraction_numerical': 0.0006226650062266501, 'mean_word_length': 2.5979843225083985, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6116788', 'n_tokens_mistral': 997, 'n_tokens_neox': 955, 'n_words': 333}