Sha256: 4ea896cb9ae04cf06f9b22e8b5a7aee1ed990a2c45489f868d4e8955157f99e6

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'

module SpreeSignifyd
  describe RequestVerifier do
    include RequestVerifier

    describe "#encode_request" do
      context "request has special characters" do
        it "returns an unescaped UTF-8 string" do
          expect(encode_request("R\xE9n\xE9 Pe\xF1a")).to eq "Réné Peña"
        end
      end

      context "request doesn't contain special characters" do
        it "returns the original string" do
          expect(encode_request("John Doe")).to eq "John Doe"
        end
      end
    end

    describe "#build_sha" do
      it "returns an HMAC SHA256 encoded message" do
        expect(build_sha('ABCDE', 'test')).to eq "K0y2rIeTA77lBEHP8cRPk64fVRbhMrZqEk7la39EjEM="
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_signifyd-1.0.0 spec/lib/spree_signifyd/request_verifier_spec.rb
solidus_signifyd-0.1.1 spec/lib/spree_signifyd/request_verifier_spec.rb