<commit_before>require 'spec_helper'

describe Gitlab::ImportExport::AvatarRestorer, lib: true do
  let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: 'test') }
  let(:project) { create(:empty_project) }

  before do
    allow_any_instance_of(described_class).to receive(:avatar_export_path)
                                                .and_return(Rails.root + "spec/fixtures/dk.png")
  end

  after do
    project.remove_avatar!
  end

  it 'restores a project avatar' do
    expect(described_class.new(project: project, shared: shared).restore).to be true
  end

  it 'saves the avatar into the project' do
    described_class.new(project: project, shared: shared).restore

    expect(project.reload.avatar.file.exists?).to be true<commit_msg>fix spec<commit_after>require 'spec_helper'

describe Gitlab::ImportExport::AvatarRestorer, lib: true do
  let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: 'test') }
  let(:project) { create(:empty_project) }

  before do
    allow_any_instance_of(described_class).to receive(:avatar_export_file)
                                                .and_return(Rails.root + "spec/fixtures/dk.png")
  end

  after do
    project.remove_avatar!
  end

  it 'restores a project avatar' do
    expect(described_class.new(project: project, shared: shared).restore).to be true
  end

  it 'saves the avatar into the project' do
    described_class.new(project: project, shared: shared).restore

    expect(project.reload.avatar.file.exists?).to be true
{'fraction_non_alphanumeric': 0.10678971654581411, 'fraction_numerical': 0.0, 'mean_word_length': 3.572289156626506, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5039998', 'n_tokens_mistral': 472, 'n_tokens_neox': 449, 'n_words': 102}