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

validate_length_of undefined method `to_allow' #210

Open
dks17 opened this issue Feb 28, 2018 · 3 comments
Open

validate_length_of undefined method `to_allow' #210

dks17 opened this issue Feb 28, 2018 · 3 comments

Comments

@dks17
Copy link
Contributor

dks17 commented Feb 28, 2018

I have:

class User
  include Mongoid::Document

  field  :name, type: String

  validates_length_of :name, in: 1..100, allow_nil: true
end
require 'rails_helper'

RSpec.describe User, type: :model do
    it { is_expected.to validate_length_of(:name).within(1..100).to_allow(nil: true) }
end

and caught the error:

Failure/Error: it { is_expected.to validate_length_of(:name).within(1..100).to_allow(nil: true) }
     NoMethodError:
       undefined method `to_allow' for #<Mongoid::Matchers::Validations::ValidateLengthOfMatcher:0x000055f3d7c01158>
       Did you mean?  to_yaml

Did I make something wrong or it is a bug?
Rails validates_length_of validator.

@dks17 dks17 changed the title validate_length_of undefined method `to_allow' for validate_length_of undefined method `to_allow' Feb 28, 2018
@dblock
Copy link
Collaborator

dblock commented Feb 28, 2018

Maybe just not implemented?

@dblock dblock added the bug? label Feb 28, 2018
@dks17
Copy link
Contributor Author

dks17 commented Mar 19, 2018

Yes. I checked code of the gem. Looks like is not implemented.
This issue should be closed or labelled as new feature.

@dks17 dks17 closed this as completed Mar 19, 2018
@dblock dblock reopened this Mar 19, 2018
@dblock
Copy link
Collaborator

dblock commented Mar 19, 2018

Reopened and relabeled.

@dblock dblock added new feature and removed bug? labels Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants