Sha256: 81e24d330bc25c003ce030adec7c76bed973dea079bdf831868ef6eaa47097ae
Contents?: true
Size: 1.59 KB
Versions: 8
Compression:
Stored size: 1.59 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Mongoa::MongoMapper do describe "#validates_inclusion_of or key :in => []" do describe "validates_inclusion_of" do it "should return true if the key has a validate_inclusion_of with the specified within" do validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:state, ["new", "uploaded"]) validation.should be_matches(Within.new) end it "should return false if the key has a validate_inclusion_of but the within doesn't match" do validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:state, ["goo", "gaa"]) validation.should_not be_matches(Within.new) end it "should return false if the key does not have a validate_inclusion_of set" do validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:foo, ["new", "uploaded"]) validation.should_not be_matches(Within.new) end end describe "in" do it "should work the same as validates_inclusion_of" do validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:state, ["new", "uploaded"]) validation.should be_matches(WithinIn.new) validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:state, ["goo", "gaa"]) validation.should_not be_matches(WithinIn.new) validation = Mongoa::MongoMapper::Matchers::ValidateInclusionOfMatcher.new(:foo, ["new", "uploaded"]) validation.should_not be_matches(WithinIn.new) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems