Sha256: e9c6b2759826308c68e48ad9b2fa4128f827449ab6b778d9ce64816e18ce444e

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe ActiveCleaner::Utf8mb3Cleaner do

  let(:cleaner) { ActiveCleaner::Utf8mb3Cleaner.new(:title) }

  describe "#clean_value" do

    it "doesn't touch legit value" do
      expect(cleaner.clean_value("A good title!")).to eq("A good title!")
    end

    it "cleans emoticons" do
      emoticons = "๐Ÿ˜€๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜ˆ๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜“๐Ÿ˜”๐Ÿ˜•๐Ÿ˜–๐Ÿ˜—๐Ÿ˜˜๐Ÿ˜™๐Ÿ˜š๐Ÿ˜›๐Ÿ˜œ๐Ÿ˜๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฅ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜จ๐Ÿ˜ฉ๐Ÿ˜ช๐Ÿ˜ซ๐Ÿ˜ฌ๐Ÿ˜ญ๐Ÿ˜ฎ๐Ÿ˜ฏ๐Ÿ˜ฐ๐Ÿ˜ฑ๐Ÿ˜ฒ๐Ÿ˜ณ๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ถ๐Ÿ˜ท๐Ÿ˜ธ๐Ÿ˜น๐Ÿ˜บ๐Ÿ˜ป๐Ÿ˜ผ๐Ÿ˜ฝ๐Ÿ˜พ๐Ÿ˜ฟ๐Ÿ™€๐Ÿ™๐Ÿ™‚๐Ÿ™…๐Ÿ™†๐Ÿ™‡๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ™‹๐Ÿ™Œ๐Ÿ™๐Ÿ™Ž๐Ÿ™"
      expect(cleaner.clean_value("A good #{emoticons} title!")).to eq("A good  title!")
    end

    it "kepts accentued chars" do
      expect(cleaner.clean_value("L'Inouรฏ Goรปter ร€ Manger.")).to eq("L'Inouรฏ Goรปter ร€ Manger.")
    end

    it "kepts japanese chars" do
      expect(cleaner.clean_value("ginkล is written as ้Š€่กŒ")).to eq("ginkล is written as ้Š€่กŒ")
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activecleaner-0.3.0 spec/lib/active_cleaner/utf8mb4_cleaner_spec.rb