aloha_analyzer 0.1.8 → 0.1.9
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/user.rb +7 -7
- data/lib/aloha_analyzer/version.rb +1 -1
- data/spec/aloha_analyzer/user_spec.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8468fe4dfc4cac6cf908816e029246531cf74b09
|
4
|
+
data.tar.gz: 437fcf53fbd6cb145b19fce4956b6bf7b8fd5dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4367d362dfa777726cffe20f70f925356bf79eec7bc55ed743da748520c52a95e8c4415e0389b9b1a986101415a32fb5d8a799e070e75bf1b528159f5d71fd1d
|
7
|
+
data.tar.gz: 932bd15e86a4c8e702db5cdc0dd87aba576573d6a530e4af95cc79a57aa484e21545975e0eb87ae0f06a02477b22561132b1e08dc93f134d67d2197432ca49ed
|
data/lib/aloha_analyzer/user.rb
CHANGED
@@ -19,17 +19,17 @@ module AlohaAnalyzer
|
|
19
19
|
analysys[:account_language][:count] += 1
|
20
20
|
analysys[:account_language][:users].push user
|
21
21
|
else
|
22
|
-
if analysys[:
|
23
|
-
analysys[:
|
24
|
-
analysys[:
|
22
|
+
if analysys[:foreign_languages][abbreviation]
|
23
|
+
analysys[:foreign_languages][abbreviation][:count] += 1
|
24
|
+
analysys[:foreign_languages][abbreviation][:users].push user
|
25
25
|
else
|
26
|
-
analysys[:
|
26
|
+
analysys[:foreign_languages][abbreviation] = {
|
27
27
|
:count => 1,
|
28
28
|
:language => Language.find_by_abbreviation(abbreviation),
|
29
29
|
:users => [user]
|
30
30
|
}
|
31
31
|
end
|
32
|
-
analysys[:
|
32
|
+
analysys[:foreign_languages_count] += 1
|
33
33
|
end
|
34
34
|
analysys[:count] += 1
|
35
35
|
end
|
@@ -46,9 +46,9 @@ module AlohaAnalyzer
|
|
46
46
|
language: Language.find_by_abbreviation(@language),
|
47
47
|
users: []
|
48
48
|
}
|
49
|
-
analysys[:
|
49
|
+
analysys[:foreign_languages_count] = 0
|
50
50
|
analysys[:count] = 0
|
51
|
-
analysys[:
|
51
|
+
analysys[:foreign_languages] = Hash.new
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -57,8 +57,8 @@ describe AlohaAnalyzer::User do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'has no results without the user language' do
|
60
|
-
subject[:
|
61
|
-
subject[:
|
60
|
+
subject[:foreign_languages].should eq({})
|
61
|
+
subject[:foreign_languages_count].should eq 0
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'includes the user lanugage' do
|
@@ -96,11 +96,11 @@ describe AlohaAnalyzer::User do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'includs the foreign followers count' do
|
99
|
-
subject[:
|
99
|
+
subject[:foreign_languages_count].should eq 2
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'returns results based on the user language' do
|
103
|
-
subject[:
|
103
|
+
subject[:foreign_languages].should == {
|
104
104
|
'fr' => {
|
105
105
|
count: 1,
|
106
106
|
language: {'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, "countries"=>"France, Canada, Belgium, Switzerland"},
|
@@ -146,8 +146,8 @@ describe AlohaAnalyzer::User do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'returns results results based on the non user language' do
|
149
|
-
subject[:
|
150
|
-
subject[:
|
149
|
+
subject[:foreign_languages].should == {}
|
150
|
+
subject[:foreign_languages_count].should eq 0
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -176,12 +176,12 @@ describe AlohaAnalyzer::User do
|
|
176
176
|
}
|
177
177
|
end
|
178
178
|
|
179
|
-
it 'includes the correct
|
180
|
-
subject[:
|
179
|
+
it 'includes the correct foreign_languages_count' do
|
180
|
+
subject[:foreign_languages_count].should eq 3
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'returns results results based on the non user language' do
|
184
|
-
subject[:
|
184
|
+
subject[:foreign_languages].should eq(
|
185
185
|
'fr' => {
|
186
186
|
:count => 2,
|
187
187
|
:language => { 'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland' },
|
@@ -217,12 +217,12 @@ describe AlohaAnalyzer::User do
|
|
217
217
|
}
|
218
218
|
end
|
219
219
|
|
220
|
-
it 'includes the correct
|
221
|
-
subject[:
|
220
|
+
it 'includes the correct foreign_languages_count' do
|
221
|
+
subject[:foreign_languages_count].should eq 1
|
222
222
|
end
|
223
223
|
|
224
224
|
it 'merges english and british' do
|
225
|
-
subject[:
|
225
|
+
subject[:foreign_languages].should eq(
|
226
226
|
'fr' => {
|
227
227
|
:count => 1,
|
228
228
|
:language => {'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland'},
|