Update mcollective.init according to OSCI-855
[packages/precise/mcollective.git] / spec / unit / plugins / mcollective / validator / array_validator_spec.rb
1 #!/usr/bin/env rspec
2 require 'spec_helper'
3 require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/validator/array_validator.rb'
4
5 module MCollective
6   module Validator
7     describe "#validate" do
8       it "should raise an exception if a given element is not defined in a given array" do
9         expect{
10           Validator::ArrayValidator.validate("element1",["element0", "element2"])
11         }.to raise_error(ValidatorError, "value should be one of element0, element2")
12       end
13
14       it "should not raise an exception if a given element is defined in a given array" do
15         Validator::ArrayValidator.validate("element1", ["element1", "element2"])
16       end
17     end
18   end
19 end