mercredi 6 juin 2018

Testing Ecto Queries in ExUnit

I am testing queries(not the data returned from queries) in the ExUnit.

Here is my code:

 test "returns the query where field like" do
   opts = %{
    "$where" => %{"first_name" => %{"$like" => "%Ham %"}}
   }

   assert build(QM.Test.Model, opts) ==
 end

The result it returned in the console is this:

 left:  #Ecto.Query<from m in QM.Test.Model,
         where: like(m.first_name, ^"%Ham %")>

How can I insert this result in the right to make the tests pass.

Any suggestions.

Thanks.

Aucun commentaire:

Enregistrer un commentaire