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

Already on GitHub? Sign in to your account

Allow non-array values for inclusion/exclusion matchers #11

Merged
merged 1 commit into from Aug 13, 2012

Conversation

Projects
None yet
4 participants
Collaborator

chancancode commented Aug 13, 2012

Say you have this model that you wanted to test...

class Order
  include Mongoid::Document
  field :total, type: Integer
  validates_inclusion_of :total, in: 0...10000000
end

Currently you'd need to write...

describe Order do
  subject { Order }
  it { must validate_inclusion_of(:total).to_allow((0...10000000).to_a) }
end

This is extremely slow.

This PR lets you do this instead:

describe Order do
  subject { Order }
  it { must validate_inclusion_of(:total).to_allow(0...10000000) }
end

This pull request passes (merged e5eabd5 into 4c910e8).

@gr4y gr4y added a commit that referenced this pull request Aug 13, 2012

@gr4y gr4y Merge pull request #11 from chancancode/validate_inclusion_of_range_etc
Allow non-array values for inclusion/exclusion matchers
d784dbc

@gr4y gr4y merged commit d784dbc into frodsan:master Aug 13, 2012

1 check passed

default The Travis build passed
Details
Owner

frodsan commented on e5eabd5 Aug 13, 2012

👍

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