When useing require(optionalSubject).toNot(beNil()), i could always add a custom description:
require(optionalSubject).toNot(beNil(), description: "repository missing value for \(key)")
this ability is lost when using the unwrap shortcut, which doesn't take a description parameter.
will it be possible to add a description argument and just pass it to the underlying toNot?
while this isn't very usefull in unwrap calls directly in tests, it's very important in helper functions doing many complex assertions, where there is a need to simply explain the error to the caller.
in these helpers, i find myself using require().toNot(beNil())
possible problems
while any expectation/requirement using to( or toNot( can pass both a custom error and a description, making the custom error override the description, here both will be in the same functions, since unwrap already takes a optional custom error. this may be confusing, arguably more/less then the expect(cutromError:).to(..., description:)
Suggestion
When useing
require(optionalSubject).toNot(beNil())
, i could always add a custom description:require(optionalSubject).toNot(beNil(), description: "repository missing value for \(key)")
this ability is lost when using the
unwrap
shortcut, which doesn't take adescription
parameter.will it be possible to add a
description
argument and just pass it to the underlyingtoNot
?while this isn't very usefull in
unwrap
calls directly in tests, it's very important in helper functions doing many complex assertions, where there is a need to simply explain the error to the caller. in these helpers, i find myself usingrequire().toNot(beNil())
possible problems
while any expectation/requirement using
to(
ortoNot(
can pass both a custom error and a description, making the custom error override the description, here both will be in the same functions, sinceunwrap
already takes a optional custom error. this may be confusing, arguably more/less then theexpect(cutromError:).to(..., description:)