shoulda-matchers icon indicating copy to clipboard operation
shoulda-matchers copied to clipboard

validates_absence_of to validate_absence_of

Open prashantham opened this issue 2 years ago • 5 comments

Spelling fix - validates_absence_of to validate_absence_of i.e validates_* to validate_*

prashantham avatar Aug 12 '22 07:08 prashantham

Hi, @prashantham, thank you so much for this contribution!

Would it be possible to fix the README too?

vsppedro avatar Aug 12 '22 14:08 vsppedro

Hi @prashantham, this doesn't seem right to me, although I admit it's a bit confusing.

  • The name of the Rails validation ends in s (e.g. validates_absence_of) because it's designed to fit into a sentence (e.g. "The post validates the absence of :name")
  • The name of the matcher doesn't (e.g. validate_absence_of) because it's designed to fit into another sentence ("The post should validate the absence of :name")

So I think what we have here is right unless you've been having issues?

mcmire avatar Aug 16 '22 17:08 mcmire

Hi @mcmire , its just a spelling mistake fix. Not a change in code.

prashantham avatar Sep 18 '22 11:09 prashantham

Hi @VSPPedro , README.md updated.

prashantham avatar Sep 18 '22 11:09 prashantham

@prashantham Right, but I'm not sure the spelling fix is correct. The way you use the validation in a typical model is by saying:

validates_absence_of :something

If you said

validate_absence_of :something

then Rails wouldn't know what you mean. Do you see what I mean? :)

mcmire avatar Sep 18 '22 16:09 mcmire

I'm cleaning up the open PRs. I will close this PR. If there is something beyond what has already been discussed feel free to re-open it.

matsales28 avatar Jan 12 '24 13:01 matsales28