diff options
Diffstat (limited to 'spec/lib/banzai/filter/normalize_source_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/normalize_source_filter_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/normalize_source_filter_spec.rb b/spec/lib/banzai/filter/normalize_source_filter_spec.rb new file mode 100644 index 00000000000..8eaeec0e7b0 --- /dev/null +++ b/spec/lib/banzai/filter/normalize_source_filter_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Banzai::Filter::NormalizeSourceFilter do + include FilterSpecHelper + + it 'removes the UTF8 BOM from the beginning of the text' do + content = "\xEF\xBB\xBF---" + + output = filter(content) + + expect(output).to match '---' + end + + it 'does not remove those characters from anywhere else in the text' do + content = <<~MD + \xEF\xBB\xBF--- + \xEF\xBB\xBF--- + MD + + output = filter(content) + + expect(output).to match "---\n\xEF\xBB\xBF---\n" + end +end |