Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure_inclusion_of should accept array as parameter #70

Closed
vpereira opened this issue Mar 13, 2012 · 3 comments
Closed

ensure_inclusion_of should accept array as parameter #70

vpereira opened this issue Mar 13, 2012 · 3 comments

Comments

@vpereira
Copy link

Hi,

I have a validation like

validates :boolean_field, :inclusion => { :in=>[true, false] }

it would be great to do something like:

it { should ensure_inclusion_of(:boolean_field).in_array [true,false] }

@jmacdonald
Copy link

I agree with this; I assumed that this already existed but was disappointed to see that it didn't.

@vpereira
Copy link
Author

yes, I did a quick patch to work, you can check my git pull request, however ideally it should work in any enumerable so maybe with some syntax sugar we could do something like

it { should ensure_inclusion_of(:attr).in_enumerable ()

@gabebw
Copy link

gabebw commented Mar 24, 2012

Looks like discussion has moved to #71, so I'm closing this. Thanks for the pull request, @vpereira!

-- Gabe

@gabebw gabebw closed this as completed Mar 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants