Sha256: 772f1d58d069c89d17a9b630d79927c31b62cb98ff7f5cdfeddddfd878f110ff

Contents?: true

Size: 891 Bytes

Versions: 1

Compression:

Stored size: 891 Bytes

Contents

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

# percent encode aka URL encoding
module Owasp
  module Esapi
    module Codec
      describe PercentCodec do
        let (:codec) { Owasp::Esapi::Codec::PercentCodec.new }

        it "should decode %3c as <" do
          codec.decode("%3c").should == "<"
        end

        it "should encode < as %3C" do
          codec.encode([],"<").should == "%3C"
        end

        it "should encode 0x100 as %C4%80" do
          s = 0x100.chr(Encoding::UTF_8)
          codec.encode([],s[0]).should == "%C4%80"
        end

        it "should decode %25F as %F" do
          codec.decode("%25F").should == "%F"
        end

        it "should encode 'Stop!' said Fred as %27Stop%21%27+said+Fred" do
          codec.encode([],"'Stop!' said Fred").should == "%27Stop%21%27+said+Fred"
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
owasp-esapi-ruby-0.30.0 spec/codec/percent_codec_spec.rb