Permalink
Browse files

Add test coverage for unicode-aware case insensitive querying.

  • Loading branch information...
1 parent 1ed64e9 commit 6d40be26c5efd92adaefd7cbc8244ca82bf309ab @jim committed May 7, 2013
Showing with 34 additions and 2 deletions.
  1. +2 −2 spec/carmen/i18n_spec.rb
  2. +25 −0 spec/carmen/region_spec.rb
  3. +7 −0 spec_data/locale/de/world.yml
View
@@ -18,7 +18,7 @@
end
it 'knows which locales are available' do
- @i18n.available_locales.must_equal ['en']
+ @i18n.available_locales.must_equal ['de', 'en']
end
it "loads and merges yaml files" do
@@ -59,7 +59,7 @@
end
it 'retains existing locales' do
- @i18n.available_locales.must_equal ['en', 'zz']
+ @i18n.available_locales.must_equal ['de', 'en', 'zz']
end
it 'stores the current locale' do
View
@@ -1,3 +1,5 @@
+# -*- encoding: utf-8 -*-
+
require 'spec_helper'
describe Carmen::Region do
@@ -82,6 +84,29 @@
eastasia = @world.subregions.named(/eastasia/i)
eastasia.name.must_equal('Eastasia')
end
+
+ describe 'unicode character handling' do
+ before do
+ Carmen.i18n_backend.locale = :de
+ end
+
+ after do
+ Carmen.i18n_backend.locale = :en
+ end
+
+ it 'can find a country using unicode characters' do
+ large = @world.subregions.named('Das großartige Staat von Eurasia')
+ large.instance_of?(Carmen::Country).must_equal true
+ large.name.must_equal('Das großartige Staat von Eurasia')
+ end
+
+ it 'can find a country using unicode characters' do
+ large = @world.subregions.named('gross', :fuzzy => true)
+ large.instance_of?(Carmen::Country).must_equal true
+ large.name.must_equal('Das großartige Staat von Eurasia')
+ end
+
+ end
end
class SortTestRegion < Carmen::Region
@@ -0,0 +1,7 @@
+---
+de:
+ world:
+ eu:
+ common_name: Eurasia
+ name: Das großartige Staat von Eurasia
+ official_name: Das großartige Staat von Eurasia

0 comments on commit 6d40be2

Please sign in to comment.