I am trying to test a view created in Postgres, but it is returning an empty result set. However, when testing out the view in an Elixir interactive shell, I get back the expected data. Here are the steps I have taken to create and test the view:
- Create a migration:
def up do
execute """
CREATE VIEW example_view AS
...
- Create the schema:
import Ecto.Changeset
schema "test_view" do
field(:user_id, :string)
- Test:
describe "example loads" do
setup [
:with_example_data
]
test "view" do
query = from(ev in Schema.ExampleView)
IO.inspect Repo.all(query)
end
end
The response back is an empty array []
Is there a setting that I am missing to allow for views to be tested in test?
Aucun commentaire:
Enregistrer un commentaire