Sha256: e5cc30010dcaf2317589963c3c9ac876f3270aabd9c81f700e0811841a0d9a4b

Contents?: true

Size: 905 Bytes

Versions: 1

Compression:

Stored size: 905 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')

module Owasp
  module Esapi
    module Validator
      describe BaseRule do
        let(:rule) {Owasp::Esapi::Validator::BaseRule.new("test")}
        it "should remove non whitelist characters" do
          rule.whitelist("12345abcdefghijkmlaaaa","abc").should == "abcaaaa"
        end

        it "should raise and exception in the base class" do
          lambda {rule.valid("test","input")}.should raise_error(Owasp::Esapi::ValidationException)
        end

        it "should return false for valid? int eh base rule" do
          rule.valid?("test","input").should be_false
        end

        it "should has an item in the error list" do
          v = Owasp::Esapi::Validator::ValidatorErrorList.new
          rule.validate("context","input",v)
          v.errors.should_not be_empty
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
owasp-esapi-ruby-0.30.0 spec/validator/base_rule_spec.rb