Skip to content

Commit 7466076

Browse files
committed
Refactor; use expect v1.0.0
1 parent 4c1754f commit 7466076

File tree

12 files changed

+254
-238
lines changed

12 files changed

+254
-238
lines changed

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ defmodule OneTruePairing.MixProject do
3939
# Type `mix help deps` for examples and options.
4040
defp deps do
4141
[
42-
{:expect, "~> 0.1.5", only: [:test], runtime: false},
42+
{:expect, "~> 1.0.0", only: [:test], runtime: false},
4343
{:error_tracker, "~> 0.5"},
4444
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
4545
{:phoenix, "~> 1.7.7"},

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
1414
"error_tracker": {:hex, :error_tracker, "0.5.1", "b3a13f5d7bd3b370520b58751d6e48387ad0a5386cacee03cd383db0d5eae1f0", [:mix], [{:ecto, "~> 3.11", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, ">= 0.0.0", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:myxql, ">= 0.0.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:phoenix_ecto, "~> 4.6", [hex: :phoenix_ecto, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "a51c05a27559237b7eabbadc799b433cbed606a6fd26daa5268d8311eeb5484c"},
1515
"esbuild": {:hex, :esbuild, "0.8.1", "0cbf919f0eccb136d2eeef0df49c4acf55336de864e63594adcea3814f3edf41", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "25fc876a67c13cb0a776e7b5d7974851556baeda2085296c14ab48555ea7560f"},
16-
"expect": {:hex, :expect, "0.1.5", "ac7daa53ebfe67e5e450f43a9a6c40e98e7b831a84baed0b5701950fbf30ba7b", [:mix], [], "hexpm", "f1220fdf7dd555d82033fb4b80cdba99dab265e1690262e77618dcf556e00e9f"},
16+
"expect": {:hex, :expect, "1.0.0", "a2446509ba2289633adb31c0e90bb05c936ed45b6d78f4fdfd3f2cbcd9817aef", [:mix], [], "hexpm", "69805a05748c1f117396d78fb058cb6f5faf7a57176656529e4d59d46ff1a048"},
1717
"expo": {:hex, :expo, "1.1.0", "f7b9ed7fb5745ebe1eeedf3d6f29226c5dd52897ac67c0f8af62a07e661e5c75", [:mix], [], "hexpm", "fbadf93f4700fb44c331362177bdca9eeb8097e8b0ef525c9cc501cb9917c960"},
1818
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
1919
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},

test/one_true_pairing/pairing_test.exs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ defmodule OneTruePairing.PairingTest do
1919
%{unpaired: unpaired, arrangements: arrangements} =
2020
decide_pairs(%{unpaired: @folks, unavailable: [], tracks: tracks}, @shuffler)
2121

22-
expect(arrangements) |> to_contain({basket_weaving, ["Alice", "Bob"]})
23-
expect(arrangements) |> to_contain({swimming, ["Carol", "Dan"]})
24-
expect(unpaired) |> to_be_empty()
22+
expect(arrangements, to: contain({basket_weaving, ["Alice", "Bob"]}))
23+
expect(arrangements, to: contain({swimming, ["Carol", "Dan"]}))
24+
expect(unpaired, to: be_empty())
2525
end
2626

2727
test "when there are more than 2 people per track of work" do
@@ -30,8 +30,8 @@ defmodule OneTruePairing.PairingTest do
3030
%{unpaired: unpaired, arrangements: arrangements} =
3131
decide_pairs(%{unpaired: @folks, unavailable: [], tracks: tracks}, @shuffler)
3232

33-
expect(arrangements) |> to_equal([{track, ["Alice", "Bob"]}])
34-
expect(unpaired) |> to_equal(["Carol", "Dan"])
33+
expect(arrangements, to: equal([{track, ["Alice", "Bob"]}]))
34+
expect(unpaired, to: equal(["Carol", "Dan"]))
3535
end
3636

3737
test "when some folks are already assigned to a track" do
@@ -47,10 +47,10 @@ defmodule OneTruePairing.PairingTest do
4747
@shuffler
4848
)
4949

50-
expect(unpaired) |> to_be_empty()
50+
expect(unpaired, to: be_empty())
5151

52-
expect(arrangements) |> to_contain({working, ["Dan", "Alice"]})
53-
expect(arrangements) |> to_contain({sleeping, ["Bob", "Carol"]})
52+
expect(arrangements, to: contain({working, ["Dan", "Alice"]}))
53+
expect(arrangements, to: contain({sleeping, ["Bob", "Carol"]}))
5454
end
5555

5656
test "when there are not enough people for the work -- it pairs people up, leaving some tracks unassigned" do
@@ -62,10 +62,10 @@ defmodule OneTruePairing.PairingTest do
6262
%{unpaired: unpaired, arrangements: arrangements} =
6363
decide_pairs(%{unpaired: ["Alice", "Bob"], tracks: tracks, unavailable: []}, @shuffler)
6464

65-
expect(arrangements) |> to_contain({allocate_me, ["Alice", "Bob"]})
66-
expect(arrangements) |> to_contain({empty_track, []})
65+
expect(arrangements, to: contain({allocate_me, ["Alice", "Bob"]}))
66+
expect(arrangements, to: contain({empty_track, []}))
6767

68-
expect(unpaired) |> to_be_empty()
68+
expect(unpaired, to: be_empty())
6969
end
7070
end
7171

test/one_true_pairing/projects/allocation_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ defmodule OneTruePairing.Projects.AllocationTest do
1818
track_id: track.id
1919
})
2020

21-
expect(changeset_valid?(changeset)) |> to_be_truthy()
21+
expect(changeset_valid?(changeset), to: be_truthy())
2222

2323
Repo.insert!(changeset)
2424
all_allocations = Repo.all(Allocation)
2525

26-
expect(all_allocations) |> to_have_length(1)
26+
expect(all_allocations, to: have_length(1))
2727
end
2828

2929
test "changeset is invalid if it lacks a person" do
3030
changeset = Allocation.changeset(%{track_id: 1})
3131

32-
expect(changeset_invalid?(changeset)) |> to_be_truthy()
32+
expect(changeset_invalid?(changeset), to: be_truthy())
3333
end
3434

3535
test "changeset is invalid if it lacks a track" do
3636
changeset = Allocation.changeset(%{person_id: 1})
3737

38-
expect(changeset_invalid?(changeset)) |> to_be_truthy()
38+
expect(changeset_invalid?(changeset), to: be_truthy())
3939
end
4040
end

test/one_true_pairing/projects/track_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ defmodule OneTruePairing.Projects.TrackTest do
1818
track = track_fixture(title: "", project_id: project.id)
1919
changeset = Track.changeset(track, %{title: ""})
2020

21-
expect(changeset_valid?(changeset)) |> to_be_truthy()
21+
expect(changeset_valid?(changeset), to: be_truthy())
2222
end
2323
end

0 commit comments

Comments
 (0)