Sha256: fabfc2a03fc3314d76dd2fd37e69bac4714e910cdc47fa5e3adcf21064e2edbf
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module Owasp module Esapi module Validator describe Zipcode do let(:validator) {Owasp::Esapi::Validator::Zipcode.new} it "should validate a good US ZIP CODE" do validator.valid?("12345").should == true end it "should validate a good US ZIP CODE" do validator.valid?("12345-6789").should == true end it "should discard a bad US ZIP CODE" do validator.valid?("foostring").should == false end it "should discard a bad US ZIP CODE" do validator.valid?("123-323").should == false end it "should validate a good Italian ZIP CODE equivalent" do validator.matcher=Owasp::Esapi::Validator::Zipcode::ITALIAN_ZIPCODE validator.valid?("20100").should == true end it "should discard an invalid Italian ZIP CODE equivalent" do validator.matcher=Owasp::Esapi::Validator::Zipcode::ITALIAN_ZIPCODE validator.valid?("121").should == false end it "should discard an invalid Italian ZIP CODE equivalent" do validator.matcher=Owasp::Esapi::Validator::Zipcode::ITALIAN_ZIPCODE validator.valid?("ipse dixit").should == false end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
owasp-esapi-ruby-0.30.0 | spec/owasp_esapi_ruby_zipcode_validator_spec.rb |