d7ff65336da6f06988e1e1f62dece6a31fea47cf
[packages/precise/mcollective.git] / spec / unit / plugins / mcollective / validator / regex_validator_spec.rb
1 #!/usr/bin/env rspec
2 require 'spec_helper'
3 require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/validator/regex_validator.rb'
4
5 module MCollective
6   module Validator
7     describe "#validate" do
8       it "should raise an exception if the given string does not matches the given regular expression" do
9         expect{
10           RegexValidator.validate("test", "nottest")
11         }.to raise_error(ValidatorError, "value should match nottest")
12       end
13
14       it "should not raise an exception if the given string's length is less than the given value" do
15         RegexValidator.validate("test", "test")
16       end
17     end
18   end
19 end