Sha256: 25321e42d42750dea0b079ff03d53278ec31287d8f3342c4fcf24ce2e37ba928

Contents?: true

Size: 646 Bytes

Versions: 9

Compression:

Stored size: 646 Bytes

Contents

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

class FakeDigest
  def self.hexdigest(key, string)
    "#{string}_signed_with_#{key}"
  end
end

describe Braintree::SignatureService do
  describe "sign" do
    it "signs the data with its key" do
      service = Braintree::SignatureService.new("my_key", FakeDigest)

      expect(service.sign(:foo => "foo bar")).to eq("foo=foo+bar_signed_with_my_key|foo=foo+bar")
    end
  end

  describe "hash" do
    it "hashes the string with its key" do
      expect(Braintree::SignatureService.new("my_key", FakeDigest).hash("foo")).to eq("foo_signed_with_my_key")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-4.23.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.22.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.21.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.20.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.19.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.18.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.17.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.16.0 spec/unit/braintree/signature_service_spec.rb
braintree-4.15.0 spec/unit/braintree/signature_service_spec.rb