# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path("../../../../../lib", __FILE__)
require_relative "../../../support/ar_models"
require "minitest/autorun"
Minitest.load :test_prof if Minitest.respond_to?(:load)

require "test-prof"

describe "Post" do
  let(:user) { TestProf::FactoryBot.create(:user) }

  it "generates random names" do
    user2 = TestProf::FactoryBot.create(:post).user
    refute_equal user.name, user2.name
  end
end

describe "User" do
  let(:user) do
    Fabricate(:user) do
      Fabricate.times(2, :post)
    end
  end

  it "validates name" do
    user.name = ""
    assert_equal user.valid?, false
  end
end
