X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Fplugins%2Fmcollective%2Fvalidator%2Flength_validator_spec.rb;fp=spec%2Funit%2Fplugins%2Fmcollective%2Fvalidator%2Flength_validator_spec.rb;h=4aa7e96f3c6aea415fbe5858d8e7d871fe261637;hb=b87d2f4e68281062df1913440ca5753ae63314a9;hp=0000000000000000000000000000000000000000;hpb=ab0ea530b8ac956091f17b104ab2311336cfc250;p=packages%2Fprecise%2Fmcollective.git diff --git a/spec/unit/plugins/mcollective/validator/length_validator_spec.rb b/spec/unit/plugins/mcollective/validator/length_validator_spec.rb new file mode 100644 index 0000000..4aa7e96 --- /dev/null +++ b/spec/unit/plugins/mcollective/validator/length_validator_spec.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env rspec +require 'spec_helper' +require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/validator/length_validator.rb' + +module MCollective + module Validator + describe "#validate" do + it "should raise an exception if the given string's length is greater than the given value" do + expect{ + LengthValidator.validate("test", 3) + }.to raise_error(ValidatorError, "Input string is longer than 3 character(s)") + end + + it "should not raise an exception if the given string's length is less than the given value" do + LengthValidator.validate("test", 4) + end + end + end +end