aloha_analyzer 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aloha_analyzer/base.rb +5 -4
- data/lib/aloha_analyzer/version.rb +1 -1
- data/spec/aloha_analyzer/facebook_spec.rb +32 -0
- data/spec/aloha_analyzer/twitter_spec.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 677e72dae554f56e36e1746aa7fab53ab57937b6
|
4
|
+
data.tar.gz: 9d01dba6b8c5e08e1bd8c40e6684d3720421d0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd40d6c868c4db0c3798124a5f5301513f4464ae16222fc73b1706cb5468eade1f5b363ca1bbafcd72102c9ef2561099e337447bf803c507b491b5da9ce76bdd
|
7
|
+
data.tar.gz: cb2beeefb013b4628a085d26703c2d941f38454635d47873fc0740249f195c9e5f32cc0df8967bd98864d3f9a154aebf85aa07de3605c155074509e79a9419cc
|
data/lib/aloha_analyzer/base.rb
CHANGED
@@ -75,10 +75,11 @@ module AlohaAnalyzer
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def add_foreign_language_user(user)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
abbreviation = Language.find_by_abbreviation(user[language_key], network_name)['abbreviation']
|
79
|
+
prepare_foreign_language(abbreviation)
|
80
|
+
@analysis['foreign_languages'][abbreviation]['count'] += 1
|
81
|
+
unless too_many_users?(@analysis['foreign_languages'][abbreviation]['users'])
|
82
|
+
@analysis['foreign_languages'][abbreviation]['users'].push(user)
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
@@ -137,6 +137,38 @@ describe AlohaAnalyzer::Facebook do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
context 'when unknown language' do
|
141
|
+
let(:users) do
|
142
|
+
[
|
143
|
+
{'id' => '1', 'locale' => 'unknown'},
|
144
|
+
{'id' => '2', 'locale' => 'something'},
|
145
|
+
{'id' => '3', 'locale' => 'en-GB'}
|
146
|
+
]
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'returns a hash' do
|
150
|
+
expect(subject).to be_a Hash
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'includes the total count' do
|
154
|
+
expect(subject['count']).to eq 3
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'includes the correct foreign_languages_count' do
|
158
|
+
expect(subject['foreign_languages_count']).to eq 2
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'returns results results based on the non user language' do
|
162
|
+
expect(subject['foreign_languages']).to eq(
|
163
|
+
'other' => {
|
164
|
+
'count' => 2,
|
165
|
+
'language' => {'abbreviation'=>'other', 'name'=>'Other', 'greeting'=>'', 'population'=>nil, 'countries' => '' },
|
166
|
+
'users'=> [{'id'=>'1', 'locale'=>'unknown'}, {'id'=>'2', 'locale'=>'something'}]
|
167
|
+
}
|
168
|
+
)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
140
172
|
context 'when only user langugages users' do
|
141
173
|
let(:users) {
|
142
174
|
[
|
@@ -254,6 +254,38 @@ describe AlohaAnalyzer::Twitter do
|
|
254
254
|
)
|
255
255
|
end
|
256
256
|
end
|
257
|
+
|
258
|
+
context 'when unknown language' do
|
259
|
+
let(:users) do
|
260
|
+
[
|
261
|
+
{'id' => '1', 'lang' => 'unknown'},
|
262
|
+
{'id' => '2', 'lang' => 'something'},
|
263
|
+
{'id' => '3', 'lang' => 'en-GB'}
|
264
|
+
]
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'returns a hash' do
|
268
|
+
expect(subject).to be_a Hash
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'includes the total count' do
|
272
|
+
expect(subject['count']).to eq 3
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'includes the correct foreign_languages_count' do
|
276
|
+
expect(subject['foreign_languages_count']).to eq 2
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'returns results results based on the non user language' do
|
280
|
+
expect(subject['foreign_languages']).to eq(
|
281
|
+
'other' => {
|
282
|
+
'count' => 2,
|
283
|
+
'language' => {'abbreviation'=>'other', 'name'=>'Other', 'greeting'=>'', 'population'=>nil, 'countries' => '' },
|
284
|
+
'users'=> [{'id'=>'1', 'lang'=>'unknown'}, {'id'=>'2', 'lang'=>'something'}]
|
285
|
+
}
|
286
|
+
)
|
287
|
+
end
|
288
|
+
end
|
257
289
|
end
|
258
290
|
|
259
291
|
context 'when user limit per language' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aloha_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Aussaguel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter_cldr
|