Sha256: f32c3a3f0de59fa46a25b226eb8624f77361c3759d95092e37c3028427961a9a

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

# encoding: utf-8
require 'minitest_helper'

describe String do

  describe 'Upcase' do

    it 'With accents' do
      'áèïôu'.upcase.must_equal 'ÁÈÏÔU'
    end
    
    it 'Without accents' do
      'aEiOu'.upcase.must_equal 'AEIOU'
    end

    it 'Change itself' do
      string = 'áèiÖU'
      string.upcase!.must_equal 'ÁÈIÖU'
      string.must_equal 'ÁÈIÖU'
    end

  end

  describe 'Downcase' do
    
    it 'With accents' do
      'ÁÈÏÔU'.downcase.must_equal 'áèïôu'
    end

    it 'Without accents' do
      'aEiOu'.downcase.must_equal 'aeiou'
    end

    it 'Change itself' do
      string = 'ÁÈIöu'
      string.downcase!.must_equal 'áèiöu'
      string.must_equal 'áèiöu'
    end

  end

  describe 'Unaccented' do

    it 'Transform keeping case' do
      string = 'Estas son mís létras MÁL acentúadäs y répetidâs íntëntândö ûtîlïzàr tôdas las varïantês'
      string.unaccented.must_equal 'Estas son mis letras MAL acentuadas y repetidas intentando utilizar todas las variantes'
      string.must_equal 'Estas son mís létras MÁL acentúadäs y répetidâs íntëntândö ûtîlïzàr tôdas las varïantês'
    end

    it 'Change itself' do
      string = 'áëÌôÛ'
      string.unaccented!.must_equal 'aeIoU'
      string.must_equal 'aeIoU'
    end
    
  end

  describe 'Normalized' do
    
    it 'Case and accents' do
      string = 'LétterS wÏth DifFèrent case ÂND Äccents'
      string.normalized.must_equal 'letters with different case and accents'
      string.must_equal 'LétterS wÏth DifFèrent case ÂND Äccents'
    end

    it 'Change itself' do
      string = 'SámPlÊ'
      string.normalized!.must_equal 'sample'
      string.must_equal 'sample'
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
core_extended-0.0.1 spec/string_spec.rb