I’m currently creating a test to test a LiveView phx-click event. For the above, I have the following setup for the tests:
setup do
%{id: follower_id, show: %{slug: slug, id: show_id} = show} = insert(:follower)
%{id: follower_id, slug: slug, show: show}
end
follower is created through a factory that has a show associated with it that is also created through a factory. But this creation of the show does not assign any value to the status field of the follower.
The structure of a show record is similar to the following (the status field can be active or discarded)
%Database.Show{
...
status: :active,
...
}
How can I change or assign a value to the status field of the show in the test setup (not in the show factory)?
I’m not sure I follow what you want to do here. Can you paste a full fuctional code fragment and explain what you expect to happen? I think there is some info missing, e.g. the setup callback should return a keyword list or :ok atom.