   use ExUnit.Case
 
   alias PaperTrail.Version
+  alias PaperTrailTest.MultiTenantHelper, as: MultiTenant
 
   @valid_attrs %{
     event: "insert",

    Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
    Code.eval_file("lib/paper_trail.ex")
    Code.eval_file("lib/version.ex")
    :ok
  end

  setup do
    @repo.delete_all(Version)
    on_exit fn ->
      @repo.delete_all(Version)
    end
    :ok
  end

    }
  end

  # Multi tenant tests
  test "[multi tenant] count works" do
    versions = add_three_versions_multi()
    Version.count(prefix: MultiTenant.tenant()) == length(versions)
  end

  test "[multi tenant] first works" do
    versions = add_three_versions_multi()
    Version.first(prefix: MultiTenant.tenant()) |> serialize == @valid_attrs
  end

  test "[multi tenant] last works" do
    versions = add_three_versions_multi()
    Version.last(prefix: MultiTenant.tenant()) |> serialize != %{
      event: "insert",
      item_type: "Person",
      item_id: 3,
      item_changes: %{first_name: "Yukihiro", last_name: "Matsumoto"},
      origin: "test",
      inserted_at: DateTime.from_naive!(~N[1965-04-14 01:00:00.000], "Etc/UTC")
    }
  end

  def add_three_versions do
    @repo.insert_all(Version, [
      @valid_attrs,
