Sorry im new to doing test cases, can anyone share with me how do you seed data for specific test case?
e.g.
describe "files" do
alias Myproject.Documents.File
import Myproject.DocumentsFixtures
@invalid_attrs %{title: nil, tmp_file_id: nil}
# QUESTION: What is the proper way to do this and i have a seeder script to run it in other environments
setup do
status = [
%{id: 1, title: "Queueing"},
%{id: 2, title: "Processing"},
%{id: 3, title: "Error"},
%{id: 4, title: "Completed"}
]
for %{id: sid} = s <- status do
case Repo.get(Status, sid) do
nil -> struct(Status, s) |> Repo.insert!(on_conflict: :nothing)
es -> es |> Status.changeset(s) |> Repo.update!(on_conflict: :nothing)
end
end
%{file: file_fixture()}
end
test "list_files/0 returns all files", %{file: file} do
assert Documents.list_files() == [file]
end
# ...