From 92aab3b494e2a7e8c6e8cbc2e92ebd53e2086906 Mon Sep 17 00:00:00 2001 From: Anthony Kinsey Date: Tue, 25 Aug 2020 14:26:41 -1000 Subject: [PATCH] fix: tests to work with board slugs --- lib/epoch/board.ex | 1 + test/epoch_test.exs | 1 + test/epoch_test/post_test.exs | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/epoch/board.ex b/lib/epoch/board.ex index 9d775d9..6d77046 100644 --- a/lib/epoch/board.ex +++ b/lib/epoch/board.ex @@ -4,6 +4,7 @@ defmodule Epoch.Board do @primary_key {:id, :binary_id, autogenerate: true} schema "boards" do field :name, :string + field :slug, :string field :description, :string field :post_count, :integer field :thread_count, :integer diff --git a/test/epoch_test.exs b/test/epoch_test.exs index 1ea7e6a..1a27522 100644 --- a/test/epoch_test.exs +++ b/test/epoch_test.exs @@ -5,6 +5,7 @@ defmodule EpochTest do def create_board(name \\ "Testing Board") do %Epoch.Board{ name: name, + slug: :crypto.strong_rand_bytes(5) |> Base.url_encode64 |> binary_part(0, 5), description: "Testing grounds for discussion", created_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second), updated_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) diff --git a/test/epoch_test/post_test.exs b/test/epoch_test/post_test.exs index 735bdf5..a985534 100644 --- a/test/epoch_test/post_test.exs +++ b/test/epoch_test/post_test.exs @@ -5,6 +5,7 @@ defmodule EpochTest.PostTest do test "post" do b = %Epoch.Board{ name: "Testing Board", + slug: :crypto.strong_rand_bytes(5) |> Base.url_encode64 |> binary_part(0, 5), description: "Testing grounds for discussion", created_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second), updated_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)