forked from dbrown/twitter-search
/
foreign_languages_test.rb
37 lines (31 loc) · 1.03 KB
/
foreign_languages_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require File.join(File.dirname(__FILE__), 'test_helper')
class ForeignLanguagesTest < Test::Unit::TestCase # :nodoc:
context "english" do
setup do
query = { :q => 'congratulations', :lang => 'en' }
fake_query(query, 'english.json')
@tweets = TwitterSearch::Client.new.query(query)
end
should_have_default_search_behaviors
should 'find tweets containing "congratulations" and are in English' do
assert @tweets.all? { |tweet|
tweet.text =~ /congratulation/i &&
tweet.language == 'en'
}
end
end
# context "client.query(:q => 'با', :lang => 'ar')" do
# setup do
# query = { :q => 'با', :lang => 'ar' }
# fake_query(query, 'arabic.json')
# @tweets = TwitterSearch::Client.new.query(query)
# end
# should_have_default_search_behaviors
# should 'find tweets containing "با" and are in Arabic' do
# assert @tweets.all? { |tweet|
# tweet.text.include?('با') &&
# tweet.language == 'ar'
# }
# end
# end
end