remove duplication of struct defaults

This commit is contained in:
James Robey
2020-08-18 10:51:05 +07:00
parent b06951ef9d
commit 0203181054

View File

@@ -43,12 +43,12 @@ defmodule Structs do
end
koan "Use the put_in macro to replace a nested value" do
airline = %Airline{plane: %Plane{maker: :boeing}}
airline = %Airline{}
assert put_in(airline.plane.maker, :airbus) == ___
end
koan "Use the update_in macro to modify a nested value" do
airline = %Airline{plane: %Plane{maker: :boeing, passengers: 200}}
airline = %Airline{plane: %Plane{passengers: 200}}
assert update_in(airline.plane.passengers, fn x -> x + 2 end) == ___
end