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 cannot cope with `[false, true]` array #338

Closed
pjg opened this Issue Aug 15, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@pjg
Contributor

pjg commented Aug 15, 2013

In the model:

validates :admin, inclusion: { in: [false, true] }

in the spec:

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

Fails with:

 Failure/Error: it { should ensure_inclusion_of(:admin).in_array([false, true]) }
   [false, true] doesn't match array in validation
 # ./spec/models/user_spec.rb:58:in `block (2 levels) in <top (required)>'

To an extent, it has been already reported/discussed in #179

@rctneil

This comment has been minimized.

Show comment
Hide comment
@rctneil

rctneil Aug 15, 2013

I would too prefer a 1 line test for this rather than 3 lines

rctneil commented Aug 15, 2013

I would too prefer a 1 line test for this rather than 3 lines

@mcmire

This comment has been minimized.

Show comment
Hide comment
@mcmire

mcmire Aug 15, 2013

Collaborator

I believe this is a dupe of #291?

Collaborator

mcmire commented Aug 15, 2013

I believe this is a dupe of #291?

@pjg

This comment has been minimized.

Show comment
Hide comment
@pjg

pjg Aug 15, 2013

Contributor

@mcmire I believe you are right :) Closing as it's a dupe of #291

Contributor

pjg commented Aug 15, 2013

@mcmire I believe you are right :) Closing as it's a dupe of #291

@pjg pjg closed this Aug 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment