From 6559de00858baf1ef040468488a5d5038ffcf328 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 26 Jun 2014 09:58:49 +1000 Subject: [PATCH] Chinese search tests --- spec/components/search_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index 1695910cf3..a40d13054d 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -335,5 +335,22 @@ describe Search do end + describe 'Chinese search' do + it 'splits English / Chinese' do + SiteSetting.default_locale = 'zh_CN' + data = Search.prepare_data('Discourse社区指南').split(' ') + data.should == ['Discourse', '社区','指南'] + end + + it 'finds chinese topic based on title' do + SiteSetting.default_locale = 'zh_TW' + topic = Fabricate(:topic, title: 'My Title Discourse社区指南') + Fabricate(:post, topic: topic) + + Search.new('社区指南').execute[0][:results][0][:id].should == topic.id + Search.new('指南').execute[0][:results][0][:id].should == topic.id + end + end + end