@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user