I have a test for uniqueness which works:
it { should validate_uniqueness_of(:name).case_insensitive }
however when I try to do a similar test for name it fails
it { should validate_presence_of(:name).allow_blank }
I get this error: undefined methodallow_blank’`
According to this list, there’s no method in shoulda that can be chained to validate_presence_of that would support what you want to do.
Have a look at the source code of the matcher here.
However, there is another matcher you can use:
Which tests if blank values can be applied to your attribute.
The full test would then be