Sha256: 5cf0b71f44fc905dd2666e06be0532f51d2b486b59cd45091992ea0946e3255a

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

require 'ronin/sql/extensions/string'

require 'spec_helper'

describe String do
  describe "SQL-hex encoding" do
    it "should be able to be SQL-hex encoded" do
      '/etc/passwd'.sql_encode.should == '0x2f6574632f706173737764'
    end

    it "should return an empty String if empty" do
      ''.sql_encode.should == ''
    end
  end

  describe "SQL-hex decoding" do
    it "should be able to be SQL-hex decoded" do
      encoded = '/etc/passwd'.sql_encode

      encoded.should == '0x2f6574632f706173737764'
      encoded.sql_decode.should == '/etc/passwd'
    end

    it "should be able to decode SQL comma-escaping" do
      "'Conan O''Brian'".sql_decode.should == "Conan O'Brian"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-sql-0.2.1 spec/sql/extensions/string_spec.rb
ronin-sql-0.2.2 spec/sql/extensions/string_spec.rb
ronin-sql-0.2.0 spec/sql/extensions/string_spec.rb