Midway: test fixes.
This commit is contained in:
@@ -17,7 +17,8 @@ defmodule Runosaari.RegistrationTest do
|
||||
date2: true,
|
||||
date3: true,
|
||||
bus: true,
|
||||
accom: true
|
||||
accom: true,
|
||||
seqnum: 1
|
||||
}
|
||||
@update_attrs %{
|
||||
confirmed: false,
|
||||
@@ -30,7 +31,8 @@ defmodule Runosaari.RegistrationTest do
|
||||
date2: true,
|
||||
date3: true,
|
||||
bus: true,
|
||||
accom: true
|
||||
accom: true,
|
||||
seqnum: 2
|
||||
}
|
||||
@invalid_attrs %{
|
||||
confirmed: nil,
|
||||
@@ -43,7 +45,8 @@ defmodule Runosaari.RegistrationTest do
|
||||
date2: nil,
|
||||
date3: nil,
|
||||
bus: nil,
|
||||
accom: nil
|
||||
accom: nil,
|
||||
seqnum: nil
|
||||
}
|
||||
|
||||
def performer_fixture(attrs \\ %{}) do
|
||||
@@ -78,6 +81,7 @@ defmodule Runosaari.RegistrationTest do
|
||||
assert performer.date3 == true
|
||||
assert performer.bus == true
|
||||
assert performer.accom == true
|
||||
assert performer.seqnum == 1
|
||||
end
|
||||
|
||||
test "create_performer/1 with invalid data returns error changeset" do
|
||||
@@ -101,6 +105,7 @@ defmodule Runosaari.RegistrationTest do
|
||||
assert performer.date3 == true
|
||||
assert performer.bus == true
|
||||
assert performer.accom == true
|
||||
assert performer.seqnum == 2
|
||||
end
|
||||
|
||||
test "update_performer/2 with invalid data returns error changeset" do
|
||||
|
||||
@@ -6,9 +6,19 @@ defmodule Runosaari.ScheduleTest do
|
||||
describe "performances" do
|
||||
alias Runosaari.Schedule.Performance
|
||||
|
||||
@valid_attrs %{description: "some description", notes: "some notes", time: ~N[2010-04-17 14:00:00]}
|
||||
@update_attrs %{description: "some updated description", notes: "some updated notes", time: ~N[2011-05-18 15:01:01]}
|
||||
@invalid_attrs %{description: nil, notes: nil, time: nil}
|
||||
@valid_attrs %{
|
||||
description: "some description",
|
||||
notes: "some notes",
|
||||
time: ~N[2010-04-17 14:00:00],
|
||||
seqnum: 1
|
||||
}
|
||||
@update_attrs %{
|
||||
description: "some updated description",
|
||||
notes: "some updated notes",
|
||||
time: ~N[2011-05-18 15:01:01],
|
||||
seqnum: 2
|
||||
}
|
||||
@invalid_attrs %{description: nil, notes: nil, time: nil, seqnum: nil}
|
||||
|
||||
def performance_fixture(attrs \\ %{}) do
|
||||
{:ok, performance} =
|
||||
@@ -34,6 +44,7 @@ defmodule Runosaari.ScheduleTest do
|
||||
assert performance.description == "some description"
|
||||
assert performance.notes == "some notes"
|
||||
assert performance.time == ~N[2010-04-17 14:00:00]
|
||||
assert performance.seqnum == 1
|
||||
end
|
||||
|
||||
test "create_performance/1 with invalid data returns error changeset" do
|
||||
@@ -42,15 +53,22 @@ defmodule Runosaari.ScheduleTest do
|
||||
|
||||
test "update_performance/2 with valid data updates the performance" do
|
||||
performance = performance_fixture()
|
||||
assert {:ok, %Performance{} = performance} = Schedule.update_performance(performance, @update_attrs)
|
||||
|
||||
assert {:ok, %Performance{} = performance} =
|
||||
Schedule.update_performance(performance, @update_attrs)
|
||||
|
||||
assert performance.description == "some updated description"
|
||||
assert performance.notes == "some updated notes"
|
||||
assert performance.time == ~N[2011-05-18 15:01:01]
|
||||
assert performance.seqnum == 2
|
||||
end
|
||||
|
||||
test "update_performance/2 with invalid data returns error changeset" do
|
||||
performance = performance_fixture()
|
||||
assert {:error, %Ecto.Changeset{}} = Schedule.update_performance(performance, @invalid_attrs)
|
||||
|
||||
assert {:error, %Ecto.Changeset{}} =
|
||||
Schedule.update_performance(performance, @invalid_attrs)
|
||||
|
||||
assert performance == Schedule.get_performance!(performance.id)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user