Sha256: d89f2d19dc0bcc8bb1de9d671f4a766cae6212b7a71b8459cd1b1ceb3a879aa2

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

require 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._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._format_and_sanitize_body_for_log(input_xml).should == expected_xml
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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