File: multibyte_spec.rb

package info (click to toggle)
ruby-mail 2.7.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,732 kB
  • sloc: ruby: 71,628; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 680 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
require 'mail/multibyte/chars'

describe Mail::Multibyte::Chars do
  it "should upcase" do
    chars = described_class.new('Laurent, où sont les tests ?')
    expect(chars.upcase).to eq("LAURENT, OÙ SONT LES TESTS ?")
  end

  it "should downcase" do
    chars = described_class.new('VĚDA A VÝZKUM')
    expect(chars.downcase).to eq("věda a výzkum")
  end

  if 'string'.respond_to?(:force_encoding)
    it "doesn't mutate input string encoding" do
      s = 'ascii'.dup.force_encoding(Encoding::US_ASCII)
      described_class.new(s)
      expect(s.encoding).to eq(Encoding::US_ASCII)
    end
  end
end