Sha256: 880b54320acd7dafef0991a3b2916d41704983ded7b696415490de18f67c0007

Contents?: true

Size: 835 Bytes

Versions: 28

Compression:

Stored size: 835 Bytes

Contents

#!/usr/bin/env rspec
require 'spec_helper'
require 'mcollective/validator/typecheck_validator'

module MCollective
  module Validator
    describe "#validate" do
      it "should raise an exception if the given value is not of the supplied type" do
        [[1, String], ['test', :integer], ['test', :float], ['test', :number], [1, :string], ['test', :boolean]].each do |val|
          expect{
            TypecheckValidator.validate(*val)
          }.to raise_error(ValidatorError, "value should be a #{val[1].to_s}")
        end
      end

      it "should not raise an exception if the given value is of the supplied type" do
        [["test", String], [1, :integer], [1.2, :float], [1, :number], ["test", :string], [true, :boolean]].each do |val|
          TypecheckValidator.validate(*val)
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
mcollective-client-2.9.1 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.9.0 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.9 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.4 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.3 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.2 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.1 spec/unit/mcollective/validator/typecheck_validator_spec.rb
mcollective-client-2.8.0 spec/unit/mcollective/validator/typecheck_validator_spec.rb