Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow passing description to unwrap requirements #1160

Closed
noamfreeman opened this issue Oct 1, 2024 · 2 comments · Fixed by #1162
Closed

Suggestion: Allow passing description to unwrap requirements #1160

noamfreeman opened this issue Oct 1, 2024 · 2 comments · Fixed by #1162

Comments

@noamfreeman
Copy link

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 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:)

@younata
Copy link
Member

younata commented Oct 11, 2024

This'll be released in the next version of Nimble, whenever I get around to fixing #1157.

@younata
Copy link
Member

younata commented Oct 13, 2024

This is now available in Nimble 13.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants