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