<commit_before>require 'rails_helper'

feature 'View person audit' do
  let(:super_admin_email)  { '<EMAIL>' }
  let!(:super_admin)  { create(:super_admin, email: super_admin_email) }

  let(:description)  { 'The best person' }
  let(:phone_number) { '55555555555' }
  let!(:person)      { with_versioning { create(:person) } }
  let(:profile_page) { Pages::Profile.new }

  before do
    with_versioning do
      person.update description: description
      person.update primary_phone_number: phone_number
    end
  end

  scenario 'View audit as an admin user' do
    omni_auth_log_in_as(super_admin.email)
    profile_page.load(slug: person.slug)

    expect(profile_page).to have_audit
    profile_page.audit.versions.tap do |v|
      expect(v[0]).to have_text "primary_phone_number => #{phone_number}"
      expect(v[1]).to have_text "description => #{description}"
      expect(v[2]).to have_text "email => #{person.email}"
    end
  end

  scenario 'Hide audit as regular user' do
    omni_auth_log_in_as(person.email)
    visit person_path(person)
    expect(page).to_not have_selector 'table.audit'
  end
end<commit_msg>Uses SitePrism in other scenario in person audit spec<commit_after>require 'rails_helper'

feature 'View person audit' do
  let(:super_admin_email)  { '<EMAIL>' }
  let!(:super_admin)  { create(:super_admin, email: super_admin_email) }

  let(:description)  { 'The best person' }
  let(:phone_number) { '55555555555' }
  let!(:person)      { with_versioning { create(:person) } }
  let(:profile_page) { Pages::Profile.new }

  before do
    with_versioning do
      person.update description: description
      person.update primary_phone_number: phone_number
    end
  end

  scenario 'View audit as an admin user' do
    omni_auth_log_in_as(super_admin.email)
    profile_page.load(slug: person.slug)

    expect(profile_page).to have_audit
    profile_page.audit.versions.tap do |v|
      expect(v[0]).to have_text "primary_phone_number => #{phone_number}"
      expect(v[1]).to have_text "description => #{description}"
      expect(v[2]).to have_text "email => #{person.email}"
    end
  end

  scenario 'Hide audit as regular user' do
    omni_auth_log_in_as(person.email)
    profile_page.load(slug: person.slug)
    expect(profile_page).to_not have_audit
  end
end
{'fraction_non_alphanumeric': 0.11468288444830582, 'fraction_numerical': 0.01216333622936577, 'mean_word_length': 4.083885209713024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '3204039', 'n_tokens_mistral': 788, 'n_tokens_neox': 765, 'n_words': 168}