Sha256: 11511d8c35b2307c4785bc9e875a9636d83bfc8bcd0252a84334d1663dfbdb05

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe Twitter::Unicode do

  it "should lazy-init constants" do
    expect(Twitter::Unicode.const_defined?(:UFEB6)).to eq(false)
    expect(Twitter::Unicode::UFEB6).to_not be_nil
    expect(Twitter::Unicode::UFEB6).to be_kind_of(String)
    expect(Twitter::Unicode.const_defined?(:UFEB6)).to eq(true)
  end

  it "should return corresponding character" do
    expect(Twitter::Unicode::UFEB6).to be == [0xfeb6].pack('U')
  end

  it "should allow lowercase notation" do
    expect(Twitter::Unicode::Ufeb6).to be == Twitter::Unicode::UFEB6
    expect(Twitter::Unicode::Ufeb6).to be === Twitter::Unicode::UFEB6
  end

  it "should allow underscore notation" do
    expect(Twitter::Unicode::U_FEB6).to be == Twitter::Unicode::UFEB6
    expect(Twitter::Unicode::U_FEB6).to be === Twitter::Unicode::UFEB6
  end

  it "should raise on invalid codepoints" do
    expect(lambda { Twitter::Unicode::FFFFFF }).to raise_error(NameError)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter-text-2.0.2 spec/unicode_spec.rb
twitter-text-2.0.1 spec/unicode_spec.rb
twitter-text-2.0.0 spec/unicode_spec.rb