An Ecto SQLite3 adapter.
0

Configure Feed

Select the types of activity you want to include in your feed.

Add test for Ecto.Enum usage

Matthew Johnston (Sep 13, 2024, 11:20 PM -0500) b39bcbaf 80adc085

+24 -1
+20
test/ecto/integration/crud_test.exs
··· 51 51 assert found.tags == [] 52 52 end 53 53 54 + test "inserts product with type set" do 55 + assert {:ok, account} = TestRepo.insert(%Account{name: "Something"}) 56 + 57 + assert {:ok, product} = 58 + TestRepo.insert(%Product{ 59 + name: "Thing", 60 + type: :inventory, 61 + account_id: account.id, 62 + approved_at: nil 63 + }) 64 + 65 + assert found = TestRepo.get(Product, product.id) 66 + assert found.id == product.id 67 + assert found.approved_at == nil 68 + assert found.description == nil 69 + assert found.type == :inventory 70 + assert found.name == "Thing" 71 + assert found.tags == [] 72 + end 73 + 54 74 test "insert_all" do 55 75 TestRepo.insert!(%User{name: "John"}, []) 56 76 timestamp = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
+1
test/support/migration.ex
··· 30 30 add(:external_id, :uuid) 31 31 add(:bid, :binary_id) 32 32 add(:tags, {:array, :string}) 33 + add(:type, :integer) 33 34 add(:approved_at, :naive_datetime) 34 35 add(:ordered_at, :utc_datetime) 35 36 add(:price, :decimal)
+3 -1
test/support/schemas/product.ex
··· 11 11 field(:name, :string) 12 12 field(:description, :string) 13 13 field(:external_id, Ecto.UUID) 14 + field(:type, Ecto.Enum, values: [inventory: 1, non_inventory: 2]) 14 15 field(:bid, :binary_id) 15 16 field(:tags, {:array, :string}, default: []) 16 17 field(:approved_at, :naive_datetime) ··· 31 32 :account_id, 32 33 :approved_at, 33 34 :ordered_at, 34 - :inserted_at 35 + :inserted_at, 36 + :type 35 37 ]) 36 38 |> validate_required([:name]) 37 39 |> maybe_generate_external_id()