forked from shibao/cannery
		
	fixup! add invite model
This commit is contained in:
		| @@ -1505,4 +1505,65 @@ defmodule Cannery.AccountsTest do | |||||||
|       refute inspect(%User{password: "123456"}) =~ "password: \"123456\"" |       refute inspect(%User{password: "123456"}) =~ "password: \"123456\"" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   describe "invites" do | ||||||
|  |     alias Cannery.Accounts.Invite | ||||||
|  |  | ||||||
|  |     @valid_attrs %{name: "some name", token: "some token"} | ||||||
|  |     @update_attrs %{name: "some updated name", token: "some updated token"} | ||||||
|  |     @invalid_attrs %{name: nil, token: nil} | ||||||
|  |  | ||||||
|  |     def invite_fixture(attrs \\ %{}) do | ||||||
|  |       {:ok, invite} = | ||||||
|  |         attrs | ||||||
|  |         |> Enum.into(@valid_attrs) | ||||||
|  |         |> Accounts.create_invite() | ||||||
|  |  | ||||||
|  |       invite | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "list_invites/0 returns all invites" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert Accounts.list_invites() == [invite] | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "get_invite!/1 returns the invite with given id" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert Accounts.get_invite!(invite.id) == invite | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "create_invite/1 with valid data creates a invite" do | ||||||
|  |       assert {:ok, %Invite{} = invite} = Accounts.create_invite(@valid_attrs) | ||||||
|  |       assert invite.name == "some name" | ||||||
|  |       assert invite.token == "some token" | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "create_invite/1 with invalid data returns error changeset" do | ||||||
|  |       assert {:error, %Ecto.Changeset{}} = Accounts.create_invite(@invalid_attrs) | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "update_invite/2 with valid data updates the invite" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert {:ok, %Invite{} = invite} = Accounts.update_invite(invite, @update_attrs) | ||||||
|  |       assert invite.name == "some updated name" | ||||||
|  |       assert invite.token == "some updated token" | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "update_invite/2 with invalid data returns error changeset" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert {:error, %Ecto.Changeset{}} = Accounts.update_invite(invite, @invalid_attrs) | ||||||
|  |       assert invite == Accounts.get_invite!(invite.id) | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "delete_invite/1 deletes the invite" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert {:ok, %Invite{}} = Accounts.delete_invite(invite) | ||||||
|  |       assert_raise Ecto.NoResultsError, fn -> Accounts.get_invite!(invite.id) end | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "change_invite/1 returns a invite changeset" do | ||||||
|  |       invite = invite_fixture() | ||||||
|  |       assert %Ecto.Changeset{} = Accounts.change_invite(invite) | ||||||
|  |     end | ||||||
|  |   end | ||||||
| end | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user