49183b88d2d820fdf8963970d28c0998062829e5
[packages/precise/mcollective.git] / spec / unit / plugins / mcollective / validator / ipv4address_validator_spec.rb
1 #!/usr/bin/env rspec
2 require 'spec_helper'
3 require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/validator/ipv4address_validator.rb'
4
5 module MCollective
6   module Validator
7     describe "#validate" do
8       it "should raise an exception if the supplied value is not an ipv4 address" do
9         expect{
10           Ipv4addressValidator.validate("foobar")
11         }.to raise_error(ValidatorError, "value should be an ipv4 address")
12       end
13
14       it "should not raise an exception if the supplied value is an ipv4 address" do
15         Ipv4addressValidator.validate("1.2.3.4")
16       end
17     end
18   end
19 end