blob: 2a270e64ae93efed99071d288b91370afa5650b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
defmodule Aggiedit.RoomsTest do
use Aggiedit.DataCase
alias Aggiedit.Rooms
describe "rooms" do
alias Aggiedit.Rooms.Room
import Aggiedit.RoomsFixtures
@invalid_attrs %{domain: nil}
test "list_rooms/0 returns all rooms" do
room = room_fixture()
assert Rooms.list_rooms() == [room]
end
test "get_room!/1 returns the room with given id" do
room = room_fixture()
assert Rooms.get_room!(room.id) == room
end
test "create_room/1 with valid data creates a room" do
valid_attrs = %{domain: "some domain"}
assert {:ok, %Room{} = room} = Rooms.create_room(valid_attrs)
assert room.domain == "some domain"
end
test "create_room/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = Rooms.create_room(@invalid_attrs)
end
test "update_room/2 with valid data updates the room" do
room = room_fixture()
update_attrs = %{domain: "some updated domain"}
assert {:ok, %Room{} = room} = Rooms.update_room(room, update_attrs)
assert room.domain == "some updated domain"
end
test "update_room/2 with invalid data returns error changeset" do
room = room_fixture()
assert {:error, %Ecto.Changeset{}} = Rooms.update_room(room, @invalid_attrs)
assert room == Rooms.get_room!(room.id)
end
test "delete_room/1 deletes the room" do
room = room_fixture()
assert {:ok, %Room{}} = Rooms.delete_room(room)
assert_raise Ecto.NoResultsError, fn -> Rooms.get_room!(room.id) end
end
test "change_room/1 returns a room changeset" do
room = room_fixture()
assert %Ecto.Changeset{} = Rooms.change_room(room)
end
end
end
|