Sha256: 03633fb00da5d1a2a8ba9649ae216aae8a8f1084b159e879998232cb5a165eb7
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' describe Appsignal::Utils do describe ".sanitize" do context "when params is a hash" do let(:params) { {'foo' => 'bar'} } it "should sanitize all hash values with a questionmark" do expect( Appsignal::Utils.sanitize(params) ).to eq('foo' => '?') end end context "when params is an array of hashes" do let(:params) { [{'foo' => 'bar'}] } it "should sanitize all hash values with a questionmark" do expect( Appsignal::Utils.sanitize(params) ).to eq([{'foo' => '?'}]) end end context "when params is an array of strings " do let(:params) { ['foo', 'bar'] } it "should sanitize all hash values with a single questionmark" do expect( Appsignal::Utils.sanitize(params) ).to eq(['?']) end end context "when params is a string" do let(:params) { 'bar'} it "should sanitize all hash values with a questionmark" do expect( Appsignal::Utils.sanitize(params) ).to eq('?') end end end describe ".sanitize_key" do it "should not sanitize key when no key_sanitizer is given" do expect( Appsignal::Utils.sanitize_key('foo', nil) ).to eql('foo') end context "with mongodb sanitizer" do it "should not sanitize key when no dots are in the key" do expect( Appsignal::Utils.sanitize_key('foo', :mongodb) ).to eql('foo') end it "should sanitize key when dots are in the key" do expect( Appsignal::Utils.sanitize_key('foo.bar', :mongodb) ).to eql('foo.?') end it "should sanitize a symbol" do expect( Appsignal::Utils.sanitize_key(:ismaster, :mongodb) ).to eql('ismaster') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appsignal-1.0.5.beta.2 | spec/lib/appsignal/utils_spec.rb |