Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / spec / unit / plugins / mcollective / validator / ipv4address_validator_spec.rb
diff --git a/spec/unit/plugins/mcollective/validator/ipv4address_validator_spec.rb b/spec/unit/plugins/mcollective/validator/ipv4address_validator_spec.rb
new file mode 100644 (file)
index 0000000..49183b8
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env rspec
+require 'spec_helper'
+require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/validator/ipv4address_validator.rb'
+
+module MCollective
+  module Validator
+    describe "#validate" do
+      it "should raise an exception if the supplied value is not an ipv4 address" do
+        expect{
+          Ipv4addressValidator.validate("foobar")
+        }.to raise_error(ValidatorError, "value should be an ipv4 address")
+      end
+
+      it "should not raise an exception if the supplied value is an ipv4 address" do
+        Ipv4addressValidator.validate("1.2.3.4")
+      end
+    end
+  end
+end