Sha256: e8f3221814073dea4fdd053a52086f0761d2f756bc576bd62c9146f133d575d4
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
# coding: utf-8 require 'rubygems' # allow activation of a specific version of activesupport for testing gem 'activesupport', "= #{ENV['DIACRITICS_FU_ACTIVESUPPORT_VERSION']}" if ENV['DIACRITICS_FU_ACTIVESUPPORT_VERSION'] require File.dirname(__FILE__) + '/spec_helper' require 'active_support' describe DiacriticsFu do before(:all) do puts "Testing using ActiveSupport version #{ActiveSupport::VERSION::STRING}" end it "should remove the accents with grace" do DiacriticsFu::escape("éphémère").should == "ephemere" DiacriticsFu::escape("éêèïîù").should eql("eeeiiu") end it "should remove more exotic accents" do DiacriticsFu::escape("räksmörgås").should eql("raksmorgas") end KNOWN_DIACRITICS = { "a" => "àäâ", "e" => "éèêë", "i" => "îï", "o" => "ôö", "u" => "üû", "c" => "ç", "I" => "ÏÎ", "E" => "ÊË", "n" => "ñ", "O" => "ÔÖ", "Y" => "Ÿ", "y" => "ÿ", "N" => "Ñ" } KNOWN_DIACRITICS.each do |expected_replacement,originals| it "should transform any of '#{originals}' into '#{expected_replacement}'" do originals.each_char do |original| DiacriticsFu.escape(original).should eql(expected_replacement) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
diacritics_fu-1.0.3 | spec/diacritics_fu_spec.rb |