Change to correct plant names

This commit is contained in:
2023-06-25 22:03:07 +03:00
parent 8d7b91abb0
commit ca47202a87
8 changed files with 99 additions and 10 deletions

View File

@@ -21,12 +21,12 @@ defmodule Osuuspuutarha.HarvestTest do
end
test "create_yield/1 with valid data creates a yield" do
valid_attrs = %{amount: "120.5", date: ~D[2023-06-07], plant: :salad, unit: :kg}
valid_attrs = %{amount: "120.5", date: ~D[2023-06-07], plant: :lettuce, unit: :kg}
assert {:ok, %Yield{} = yield} = Harvest.create_yield(valid_attrs)
assert yield.amount == Decimal.new("120.5")
assert yield.date == ~D[2023-06-07]
assert yield.plant == :salad
assert yield.plant == :lettuce
assert yield.unit == :kg
end

View File

@@ -4,8 +4,18 @@ defmodule OsuuspuutarhaWeb.YieldLiveTest do
import Phoenix.LiveViewTest
import Osuuspuutarha.HarvestFixtures
@create_attrs %{amount: "120.5", date: %{day: 7, month: 6, year: 2023}, plant: :salad, unit: :kg}
@update_attrs %{amount: "456.7", date: %{day: 8, month: 6, year: 2023}, plant: :carrot, unit: :kpl}
@create_attrs %{
amount: "120.5",
date: %{day: 7, month: 6, year: 2023},
plant: :lettuce,
unit: :kg
}
@update_attrs %{
amount: "456.7",
date: %{day: 8, month: 6, year: 2023},
plant: :carrot,
unit: :kpl
}
@invalid_attrs %{amount: nil, date: %{day: 30, month: 2, year: 2023}, plant: nil, unit: nil}
defp create_yield(_) do

View File

@@ -13,7 +13,7 @@ defmodule Osuuspuutarha.HarvestFixtures do
|> Enum.into(%{
amount: "120.5",
date: ~D[2023-06-07],
plant: :salad,
plant: :lettuce,
unit: :kg
})
|> Osuuspuutarha.Harvest.create_yield()