DockYard / valid_field

https://hex.pm/packages/valid_field
MIT License
48 stars 6 forks source link

Make failure messages more specific #10

Closed lpil closed 8 years ago

lpil commented 8 years ago

When one of the given examples is invalid or valid when it should not be it would be nice if the exact example that failed was given, rather than listing all the ones that have failed.

bcardarella commented 8 years ago

@lpil just want to make sure I understand. You're suggesting for the following:

ValidField.assert_valid_field(:email, ["test@example.com", "other@example.com"])

that currently the error message is: ** (ExUnit.AssertionError) Expected the following values to be valid for "email": "test@example.com", "other@example.com"

but you are looking for: ** (ExUnit.AssertionError) Expected the following values to be valid for "email": "other@example.com" ?

Assuming other@example.com causes the failure

lpil commented 8 years ago

Yes, that's the one! On 26 Dec 2015 14:09, "Brian Cardarella" notifications@github.com wrote:

@lpil https://github.com/lpil just want to make sure I understand. You're suggesting for the following:

ValidField.assert_valid_field(:email, ["test@example.com", "other@example.com"])

that currently the error message is: \ (ExUnit.AssertionError) Expected the following values to be valid for "email": "test@example.com", " other@example.com"

but you are looking for: \ (ExUnit.AssertionError) Expected the following values to be valid for "email": "other@example.com" ?

— Reply to this email directly or view it on GitHub https://github.com/dockyard/valid_field/issues/10#issuecomment-167327173 .

bcardarella commented 8 years ago

@lpil cool, I am :+1: on this. Will take a look

bcardarella commented 8 years ago

@lpil I recreated the conditions here: https://github.com/dockyard/valid_field/pull/11 but it appears the behavior is already happening. Are you seeing something different?

danmcclain commented 8 years ago

I was going to say that it should only be showing the failure cases, not the passing cases

lpil commented 8 years ago

Ah, then I must have misunderstood the error message. Thanks all!