Add adresses

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-01-17 11:39:01 +01:00
parent bfcdc38076
commit 07382d6aca
19 changed files with 551 additions and 42 deletions

View File

@@ -13,8 +13,12 @@ defmodule Eventos.EventsTest do
insert(:account)
end
def address_fixture do
insert(:address)
end
def event_fixture do
insert(:event, organizer_account: account_fixture())
insert(:event)
end
def category_fixture do
@@ -42,9 +46,12 @@ defmodule Eventos.EventsTest do
test "create_event/1 with valid data creates a event" do
{:ok, account} = Accounts.create_account(@account_valid_attrs)
category = category_fixture()
valid_attrs_with_account_id = Map.put(@event_valid_attrs, :organizer_account_id, account.id)
valid_attrs_with_account_id = Map.put(valid_attrs_with_account_id, :category_id, category.id)
assert {:ok, %Event{} = event} = Events.create_event(valid_attrs_with_account_id)
address = address_fixture()
valid_attrs = Map.put(@event_valid_attrs, :organizer_account_id, account.id)
valid_attrs = valid_attrs
|> Map.put(:category_id, category.id)
|> Map.put(:address_id, address.id)
assert {:ok, %Event{} = event} = Events.create_event(valid_attrs)
assert event.begins_on == DateTime.from_naive!(~N[2010-04-17 14:00:00.000000Z], "Etc/UTC")
assert event.description == "some description"
assert event.ends_on == DateTime.from_naive!(~N[2010-04-17 14:00:00.000000Z], "Etc/UTC")