where :year is of type string. How do I test this in shoulda? Is it
with
(1) should ensure_inclusion_of
or do I have to do
(2) should allow_value('09-10').for(:year) and the should_not
equivalents?
So? (2) seems verbose... I mean, having to do a bunch of should's and
should_not's?
where :year is of type string. How do I test this in shoulda? Is it
with
(1) should ensure_inclusion_of
or do I have to do
(2) should allow_value(‘09-10’).for(:year) and the should_not
equivalents?
So? (2) seems verbose… I mean, having to do a bunch of should’s and
should_not’s?
I would be curious if there was another way if I understand exactly what you are doing, but I think (2) is what you have to do… seems to me it is similar to validating the format of an attribute.
Although, you might have to change your structure but seems that somehow you could use “should include_value_in_range”…
where :year is of type string. How do I test this in shoulda? Is it
with
(1) should ensure_inclusion_of
or do I have to do
(2) should allow_value(‘09-10’).for(:year) and the should_not
equivalents?
So? (2) seems verbose… I mean, having to do a bunch of should’s and
should_not’s?
I would be curious if there was another way if I understand exactly what you are doing, but I think (2) is what you have to do… seems to me it is similar to validating the format of an attribute.
Although, you might have to change your structure but seems that somehow you could use “should include_value_in_range”…
Oops, I was looking at deprecated stuff… anyhow you would probably have to change your structure to something numeric or date-like to use ensure_inclusion_of but maybe in the end that would be the right way to do it.