Skip to content

Instantly share code, notes, and snippets.

@cayblood
Created August 12, 2016 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cayblood/4c992d8b862809ec501d546089edb741 to your computer and use it in GitHub Desktop.
Save cayblood/4c992d8b862809ec501d546089edb741 to your computer and use it in GitHub Desktop.
defmodule Juno.Factory do
use ExMachina.Ecto, repo: Juno.Repo
# import GoodTimes
# import GoodTimes.Convert
alias Juno.Transaction
alias Juno.VirtualCard
def transaction_factory do
%Transaction {
description: "Description",
amount: 10.59,
virtual_card: build(:virtual_card)
}
end
def virtual_card_factory do
{:ok, time} = Ecto.DateTime.cast({{2001, 2, 3}, {4, 5, 6}})
%VirtualCard {
name: sequence("Virtual Card "),
external_id: sequence("external_id_"),
last_four: sequence("000"),
expires_at: time,
amount: 150.00,
transactions: build_list(2, :transaction)
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment