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.
I have:
and caught the error:
Did I make something wrong or it is a bug? Rails validates_length_of validator.