When not possible to determine otherwise, assums a record has been released
This commit is contained in:
@@ -227,7 +227,10 @@ defmodule MusicLibrary.Records.Record do
|
||||
Date.compare(current_day, release_date) != :lt
|
||||
|
||||
_error ->
|
||||
false
|
||||
# When a release date cannot be parsed it's normally because the record
|
||||
# is old and information is not specific, so we can err on the side of assuming
|
||||
# it's been released.
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ defmodule MusicLibrary.Records.RecordTest do
|
||||
assert MusicLibrary.Records.Record.released?(record, current_date)
|
||||
end
|
||||
|
||||
test "it returns false if the release date is not precise enough", %{
|
||||
test "it returns true if the release date is not precise enough", %{
|
||||
current_date: current_date
|
||||
} do
|
||||
record = %MusicLibrary.Records.Record{release: "2019"}
|
||||
refute MusicLibrary.Records.Record.released?(record, current_date)
|
||||
assert MusicLibrary.Records.Record.released?(record, current_date)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user