Sha256: f3e76f4eb6cd7cd3240ecb5f748b5a36ecf7effacf4254d8c923b4d5a326fd43

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe Braintree::Digest do
  describe "self.hexdigest" do
    it "returns the sha1 hmac of the input string (test case 6 from RFC 2202)" do
      begin
        original_key = Braintree::Configuration.private_key
        Braintree::Configuration.private_key = "\xaa" * 80
        data = "Test Using Larger Than Block-Size Key - Hash Key First"
        Braintree::Digest.hexdigest(data).should == "aa4ae5e15272d00e95705637ce8a3b55ed402112"
      ensure
        Braintree::Configuration.private_key = original_key
      end
    end

    it "returns the sha1 hmac of the input string (test case 7 from RFC 2202)" do
      begin
        original_key = Braintree::Configuration.private_key
        Braintree::Configuration.private_key = "\xaa" * 80
        data = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"
        Braintree::Digest.hexdigest(data).should == "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"
      ensure
        Braintree::Configuration.private_key = original_key
      end
    end

    it "doesn't blow up if message is nil" do
      expect { Braintree::Digest.hexdigest(nil) }.to_not raise_error
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
braintree-2.4.0 spec/unit/braintree/digest_spec.rb
braintree-2.3.1 spec/unit/braintree/digest_spec.rb
braintree-2.2.0 spec/unit/braintree/digest_spec.rb
braintree-2.1.0 spec/unit/braintree/digest_spec.rb
braintree-2.0.0 spec/unit/braintree/digest_spec.rb
braintree-1.2.1 spec/unit/braintree/digest_spec.rb
braintree-1.2.0 spec/unit/braintree/digest_spec.rb
braintree-1.1.3 spec/unit/braintree/digest_spec.rb
braintree-1.1.2 spec/unit/braintree/digest_spec.rb
braintree-1.1.1 spec/unit/braintree/digest_spec.rb
braintree-1.1.0 spec/unit/braintree/digest_spec.rb