Testing validates_inclusion_of / booleans?

182 views
Skip to first unread message

Arron Washington

unread,
Aug 18, 2008, 7:39:24 PM8/18/08
to shoulda
Yo.

Just started playing around with Shoulda as an experiment, but I can't
seem to find a way to test booleans?

model/user.rb

validates_inclusion_of :is_a_serial_killer, :in => [true, false]

What would be the Shoulda unit test equivalent?

david.l...@gmail.com

unread,
Aug 18, 2008, 8:29:21 PM8/18/08
to sho...@googlegroups.com
should_allow_values_for :is_a_serial_killer, true, false
should_not_allow_values_for :is_a_serial_killer, "some string", 666

-David

Arron Washington

unread,
Aug 18, 2008, 10:23:20 PM8/18/08
to shoulda
Shazbot.

I saw that, but was hoping there'd be something less... verbose, like
should_only_allow_values.

Well, this'll do I guess. Thanks.

david.l...@gmail.com

unread,
Aug 18, 2008, 11:09:01 PM8/18/08
to sho...@googlegroups.com
feel free to contribute a new macro, it's open source :)

-D

Arron Washington

unread,
Aug 19, 2008, 8:58:24 PM8/19/08
to shoulda
Yeah, I could do that. =D
Reply all
Reply to author
Forward
0 new messages