architex/lib/matrix_server/quick_check.ex

15 lines
494 B
Elixir
Raw Normal View History

defmodule MatrixServer.QuickCheck do
import Ecto.Query
alias MatrixServer.{Repo, Room, Account, RoomServer}
alias MatrixServerWeb.Client.Request.CreateRoom
def create_room(name \\ nil, topic \\ nil) do
account = Repo.one!(from a in Account, limit: 1)
input = %CreateRoom{name: name, topic: topic}
%Room{id: room_id} = Repo.insert!(Room.create_changeset(input))
{:ok, pid} = RoomServer.get_room_server(room_id)
RoomServer.create_room(pid, account, input)
end
end