Sha256: 63290e68129c247edacee630d2722efd8a297ed0fade13914eda5cebcab056ab

Contents?: true

Size: 1.14 KB

Versions: 35

Compression:

Stored size: 1.14 KB

Contents

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

describe Braintree::Http do
  describe "self._format_and_sanitize_body_for_log" do
    it "adds [Braintree] before each line" do
      input_xml = <<-END
<customer>
  <first-name>Joe</first-name>
  <last-name>Doe</last-name>
</customer>
END
      expected_xml = <<-END
[Braintree] <customer>
[Braintree]   <first-name>Joe</first-name>
[Braintree]   <last-name>Doe</last-name>
[Braintree] </customer>
END
      Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml).should == expected_xml
    end

    it "sanitizes credit card number and cvv" do
      input_xml = <<-END
<customer>
  <first-name>Joe</first-name>
  <last-name>Doe</last-name>
  <number>1234560000001234</number>
  <cvv>123</cvv>
</customer>
      END

      expected_xml = <<-END
[Braintree] <customer>
[Braintree]   <first-name>Joe</first-name>
[Braintree]   <last-name>Doe</last-name>
[Braintree]   <number>123456******1234</number>
[Braintree]   <cvv>***</cvv>
[Braintree] </customer>
END
      Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml).should == expected_xml
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
braintree-2.30.0 spec/unit/braintree/http_spec.rb
braintree-2.29.0 spec/unit/braintree/http_spec.rb
braintree-2.28.0 spec/unit/braintree/http_spec.rb
braintree-2.27.1 spec/unit/braintree/http_spec.rb
braintree-2.27.0 spec/unit/braintree/http_spec.rb
braintree-2.26.0 spec/unit/braintree/http_spec.rb
braintree-2.25.0 spec/unit/braintree/http_spec.rb
braintree-2.24.0 spec/unit/braintree/http_spec.rb
braintree-2.23.0 spec/unit/braintree/http_spec.rb
braintree-2.22.0 spec/unit/braintree/http_spec.rb
braintree-2.21.0 spec/unit/braintree/http_spec.rb
braintree-2.20.0 spec/unit/braintree/http_spec.rb
braintree-2.19.0 spec/unit/braintree/http_spec.rb
braintree-2.18.0 spec/unit/braintree/http_spec.rb
braintree-2.17.0 spec/unit/braintree/http_spec.rb
braintree-2.16.0 spec/unit/braintree/http_spec.rb
braintree-2.15.0 spec/unit/braintree/http_spec.rb
braintree-2.14.0 spec/unit/braintree/http_spec.rb
braintree-2.13.4 spec/unit/braintree/http_spec.rb
braintree-2.13.3 spec/unit/braintree/http_spec.rb