Sha256: d14241c0b686922170bb4c39b0550bcdf9b539aa01e416e12c7231f87f42eedf
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' describe Roqua::Healthy::MessageCleaner do let(:message) { {key: ""} } describe '#message' do it 'leaves clean messages untouched' do message = {key: 'value', other_key: double} cleaned = Roqua::Healthy::MessageCleaner.new(message).message expect(cleaned).to eq(message) end it 'cleans strings that contain only a pair of double quotes' do message = {key: '""'} cleaned = Roqua::Healthy::MessageCleaner.new(message).message expect(cleaned).to eq(key: '') end it 'cleans strings in subhashes' do message = {key: {subkey: '""'}} cleaned = Roqua::Healthy::MessageCleaner.new(message).message expect(cleaned).to eq(key: {subkey: ''}) end it 'cleans strings in arrays' do message = {key: [{subkey: '""'}, {subkey: 'foo'}]} cleaned = Roqua::Healthy::MessageCleaner.new(message).message expect(cleaned).to eq(key: [{subkey: ''}, {subkey: 'foo'}]) end end describe '#clean_string' do let(:cleaner) { Roqua::Healthy::MessageCleaner.new("") } it 'does not change clean strings' do expect(cleaner.clean_string("a string")).to eq("a string") end it 'strips whitespace' do expect(cleaner.clean_string(" a string ")).to eq("a string") end it 'sanitizes strings that are only a pair of double quotes' do expect(cleaner.clean_string('""')).to eq('') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
roqua-healthy-1.4.1 | spec/unit/message_cleaner_spec.rb |
roqua-healthy-1.3.0 | spec/unit/message_cleaner_spec.rb |
roqua-healthy-1.2.1 | spec/unit/message_cleaner_spec.rb |