aloha_analyzer 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,37 +3,37 @@ require 'spec_helper'
3
3
  describe AlohaAnalyzer::Language do
4
4
  describe '.all' do
5
5
  it 'returns a Hash' do
6
- described_class.all.should be_a Hash
6
+ expect(described_class.all).to be_a Hash
7
7
  end
8
8
 
9
9
  it 'is not empty' do
10
- described_class.all.should_not be_empty
10
+ expect(described_class.all).not_to be_empty
11
11
  end
12
12
  end
13
13
 
14
14
  describe '.find_by_abbreviation' do
15
- subject(:language) { described_class.find_by_abbreviation(abbreviation) }
15
+ subject(:language) { described_class.find_by_abbreviation(abbreviation, 'twitter') }
16
16
  context 'when it exits' do
17
17
  let(:abbreviation) { 'fr' }
18
18
 
19
19
  it 'returns a hash' do
20
- subject.should be_a Hash
20
+ expect(subject).to be_a Hash
21
21
  end
22
22
 
23
23
  it 'includes the total language population' do
24
- subject['population'].should be_a Fixnum
24
+ expect(subject['population']).to be_a Fixnum
25
25
  end
26
26
 
27
27
  it 'includes the language name' do
28
- subject['name'].should eq 'French'
28
+ expect(subject['name']).to eq 'French'
29
29
  end
30
30
 
31
31
  it 'includes the language abbreviation' do
32
- subject['abbreviation'].should eq 'fr'
32
+ expect(subject['abbreviation']).to eq 'fr'
33
33
  end
34
34
 
35
35
  it 'includes the languages countries' do
36
- subject['countries'].should eq 'France, Canada, Belgium, Switzerland'
36
+ expect(subject['countries']).to eq 'France, Canada, Belgium, Switzerland'
37
37
  end
38
38
  end
39
39
 
@@ -41,24 +41,24 @@ describe AlohaAnalyzer::Language do
41
41
  let(:abbreviation) { 'esperanto' }
42
42
 
43
43
  it 'returns a hash' do
44
- subject.should be_a Hash
44
+ expect(subject).to be_a Hash
45
45
  end
46
46
 
47
47
  it 'has no population' do
48
- subject['population'].should be_a Fixnum
49
- subject['population'].should eq 0
48
+ expect(subject['population']).to be_a Fixnum
49
+ expect(subject['population']).to eq 0
50
50
  end
51
51
 
52
52
  it 'other as a name' do
53
- subject['name'].should eq 'Other'
53
+ expect(subject['name']).to eq 'Other'
54
54
  end
55
55
 
56
56
  it 'includes the other abbreviation' do
57
- subject['abbreviation'].should eq 'other'
57
+ expect(subject['abbreviation']).to eq 'other'
58
58
  end
59
59
 
60
60
  it 'includes no countries' do
61
- subject['countries'].should eq ''
61
+ expect(subject['countries']).to eq ''
62
62
  end
63
63
  end
64
64
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe AlohaAnalyzer::User do
4
- subject(:user) { described_class.new(options) }
3
+ describe AlohaAnalyzer::Twitter do
4
+ subject(:twitter) { described_class.new(options) }
5
5
  let(:language) { 'en' }
6
6
  let(:options) do
7
7
  {
@@ -17,7 +17,7 @@ describe AlohaAnalyzer::User do
17
17
  let(:language) { 'en-gb' }
18
18
 
19
19
  it 'changes to english' do
20
- subject.language.should eq 'en'
20
+ expect(subject.language).to eq 'en'
21
21
  end
22
22
  end
23
23
 
@@ -25,7 +25,7 @@ describe AlohaAnalyzer::User do
25
25
  let(:language) { 'zh-cn' }
26
26
 
27
27
  it 'changes to chinese' do
28
- subject.language.should eq 'zh'
28
+ expect(subject.language).to eq 'zh'
29
29
  end
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ describe AlohaAnalyzer::User do
33
33
  let(:language) { 'zh-tw' }
34
34
 
35
35
  it 'changes to chinese' do
36
- subject.language.should eq 'zh'
36
+ expect(subject.language).to eq 'zh'
37
37
  end
38
38
  end
39
39
 
@@ -41,11 +41,11 @@ describe AlohaAnalyzer::User do
41
41
  let(:analysis) { { foo: :bar } }
42
42
 
43
43
  it 'sets the analysis to the argument' do
44
- subject.analysis.should eq analysis
44
+ expect(subject.analysis).to eq analysis
45
45
  end
46
46
 
47
47
  it 'clones the hash' do
48
- subject.analysis.object_id.should_not eq analysis.object_id
48
+ expect(subject.analysis.object_id).not_to eq analysis.object_id
49
49
  end
50
50
  end
51
51
 
@@ -53,11 +53,11 @@ describe AlohaAnalyzer::User do
53
53
  let(:analysis) { nil }
54
54
 
55
55
  it 'sets the analysis to the analysis boilerplate' do
56
- subject.analysis.should eq subject.boilerplate
56
+ expect(subject.analysis).to eq subject.boilerplate
57
57
  end
58
58
 
59
59
  it 'clones the hash' do
60
- subject.analysis.object_id.should_not eq subject.boilerplate.object_id
60
+ expect(subject.analysis.object_id).not_to eq subject.boilerplate.object_id
61
61
  end
62
62
  end
63
63
  end
@@ -68,24 +68,24 @@ describe AlohaAnalyzer::User do
68
68
  let(:users) { [] }
69
69
 
70
70
  it 'returns a hash' do
71
- subject.should be_a Hash
71
+ expect(subject).to be_a Hash
72
72
  end
73
73
 
74
74
  it 'includes the total count' do
75
- subject['count'].should eq 0
75
+ expect(subject['count']).to eq 0
76
76
  end
77
77
 
78
78
  it 'has no results with the user language' do
79
- subject['account_language']['count'].should eq 0
79
+ expect(subject['account_language']['count']).to eq 0
80
80
  end
81
81
 
82
82
  it 'has no results without the user language' do
83
- subject['foreign_languages'].should eq({})
84
- subject['foreign_languages_count'].should eq 0
83
+ expect(subject['foreign_languages']).to eq({})
84
+ expect(subject['foreign_languages_count']).to eq 0
85
85
  end
86
86
 
87
87
  it 'includes the user lanugage' do
88
- subject['account_language']['language'].should eq(
88
+ expect(subject['account_language']['language']).to eq(
89
89
  'abbreviation'=>'en', 'greeting' => 'hello!', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia'
90
90
  )
91
91
  end
@@ -103,15 +103,15 @@ describe AlohaAnalyzer::User do
103
103
  }
104
104
 
105
105
  it 'returns a hash' do
106
- subject.should be_a Hash
106
+ expect(subject).to be_a Hash
107
107
  end
108
108
 
109
109
  it 'includes the total count' do
110
- subject['count'].should eq 4
110
+ expect(subject['count']).to eq 4
111
111
  end
112
112
 
113
113
  it 'includes the user lanugage' do
114
- subject['account_language'].should eq(
114
+ expect(subject['account_language']).to eq(
115
115
  'count' => 2,
116
116
  'language' => {'abbreviation'=>'en', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia', 'greeting'=>'hello!'},
117
117
  'users' => [{'id' => '1', 'lang' => 'en'}, {'id' => '3', 'lang' => 'en'}]
@@ -119,11 +119,11 @@ describe AlohaAnalyzer::User do
119
119
  end
120
120
 
121
121
  it 'includs the foreign followers count' do
122
- subject['foreign_languages_count'].should eq 2
122
+ expect(subject['foreign_languages_count']).to eq 2
123
123
  end
124
124
 
125
125
  it 'returns results based on the user language' do
126
- subject['foreign_languages'].should == {
126
+ expect(subject['foreign_languages']).to eq({
127
127
  'fr' => {
128
128
  'count' => 1,
129
129
  'language' => {'abbreviation'=>'fr', 'name'=>'French', 'greeting'=>'bonjour!', 'population'=>14000000, 'countries'=>'France, Canada, Belgium, Switzerland'},
@@ -134,7 +134,7 @@ describe AlohaAnalyzer::User do
134
134
  'language' => {'abbreviation'=>'de', 'name'=>'German', 'greeting'=>'hallo!', 'population'=>6000000, 'countries'=>'Germany, Austria, Switzerland, Belgium'},
135
135
  'users' => [{'id' => '4', 'lang' => 'de'}]
136
136
  }
137
- }
137
+ })
138
138
  end
139
139
  end
140
140
 
@@ -147,30 +147,30 @@ describe AlohaAnalyzer::User do
147
147
  }
148
148
 
149
149
  it 'returns a hash' do
150
- subject.should be_a Hash
150
+ expect(subject).to be_a Hash
151
151
  end
152
152
 
153
153
  it 'includes the total count' do
154
- subject['count'].should eq 2
154
+ expect(subject['count']).to eq 2
155
155
  end
156
156
 
157
157
  it 'includes the user lanugage' do
158
- subject['account_language']['language'].should eq(
158
+ expect(subject['account_language']['language']).to eq(
159
159
  'abbreviation'=>'en', 'greeting' => 'hello!', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia'
160
160
  )
161
161
  end
162
162
 
163
163
  it 'returns results based on the user language' do
164
- subject['account_language'].should == {
164
+ expect(subject['account_language']).to eq({
165
165
  'count' => 2,
166
166
  'language' => {'abbreviation'=>'en', 'name'=>'English', 'population'=>239000000, 'countries' => 'USA, UK, Canada, Ireland, Australia', 'greeting'=>'hello!'},
167
167
  'users' => [{'id' => '1', 'lang' => 'en'}, {'id' => '2', 'lang' => 'en'}]
168
- }
168
+ })
169
169
  end
170
170
 
171
171
  it 'returns results results based on the non user language' do
172
- subject['foreign_languages'].should == {}
173
- subject['foreign_languages_count'].should eq 0
172
+ expect(subject['foreign_languages']).to eq({})
173
+ expect(subject['foreign_languages_count']).to eq 0
174
174
  end
175
175
  end
176
176
 
@@ -184,27 +184,27 @@ describe AlohaAnalyzer::User do
184
184
  }
185
185
 
186
186
  it 'returns a hash' do
187
- subject.should be_a Hash
187
+ expect(subject).to be_a Hash
188
188
  end
189
189
 
190
190
  it 'includes the total count' do
191
- subject['count'].should eq 3
191
+ expect(subject['count']).to eq 3
192
192
  end
193
193
 
194
194
  it 'returns results based on the user language' do
195
- subject['account_language'].should == {
195
+ expect(subject['account_language']).to eq({
196
196
  'count' => 0,
197
197
  'language' => {'abbreviation'=>'en', 'greeting' => 'hello!', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia'},
198
198
  'users' => []
199
- }
199
+ })
200
200
  end
201
201
 
202
202
  it 'includes the correct foreign_languages_count' do
203
- subject['foreign_languages_count'].should eq 3
203
+ expect(subject['foreign_languages_count']).to eq 3
204
204
  end
205
205
 
206
206
  it 'returns results results based on the non user language' do
207
- subject['foreign_languages'].should eq(
207
+ expect(subject['foreign_languages']).to eq(
208
208
  'fr' => {
209
209
  'count' => 2,
210
210
  'language' => { 'abbreviation'=>'fr', 'name'=>'French', 'greeting'=>'bonjour!', 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland' },
@@ -229,23 +229,23 @@ describe AlohaAnalyzer::User do
229
229
  }
230
230
 
231
231
  it 'includes the total count' do
232
- subject['count'].should eq 3
232
+ expect(subject['count']).to eq 3
233
233
  end
234
234
 
235
235
  it 'includes the user lanugage' do
236
- subject['account_language'].should == {
236
+ expect(subject['account_language']).to eq({
237
237
  'count' => 2,
238
238
  'language' => { 'abbreviation'=>'en', 'greeting' => 'hello!', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia' },
239
239
  'users' => [{'id' => '1', 'lang' => 'en'}, {'id' => '3', 'lang' => 'en'}]
240
- }
240
+ })
241
241
  end
242
242
 
243
243
  it 'includes the correct foreign_languages_count' do
244
- subject['foreign_languages_count'].should eq 1
244
+ expect(subject['foreign_languages_count']).to eq 1
245
245
  end
246
246
 
247
247
  it 'merges english and british' do
248
- subject['foreign_languages'].should eq(
248
+ expect(subject['foreign_languages']).to eq(
249
249
  'fr' => {
250
250
  'count' => 1,
251
251
  'language' => {'abbreviation'=>'fr', 'name'=>'French', 'greeting'=>'bonjour!', 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland'},
@@ -275,27 +275,27 @@ describe AlohaAnalyzer::User do
275
275
  }
276
276
 
277
277
  it 'limits the number of account language users to 1' do
278
- subject['account_language']['users'].size.should eq 1
278
+ expect(subject['account_language']['users'].size).to eq 1
279
279
  end
280
280
 
281
281
  it 'limits the number of foreign languages users to 1' do
282
- subject['foreign_languages']['fr']['users'].size.should eq 1
282
+ expect(subject['foreign_languages']['fr']['users'].size).to eq 1
283
283
  end
284
284
 
285
285
  it 'does not affect the account language count' do
286
- subject['account_language']['count'].should eq 2
286
+ expect(subject['account_language']['count']).to eq 2
287
287
  end
288
288
 
289
289
  it 'does not affect the foreign_languages_count' do
290
- subject['foreign_languages_count'].should eq 3
290
+ expect(subject['foreign_languages_count']).to eq 3
291
291
  end
292
292
 
293
293
  it 'does not affect the total count' do
294
- subject['count'].should eq 5
294
+ expect(subject['count']).to eq 5
295
295
  end
296
296
 
297
297
  it 'does not affect a foreign language count' do
298
- subject['foreign_languages']['fr']['count'].should eq 3
298
+ expect(subject['foreign_languages']['fr']['count']).to eq 3
299
299
  end
300
300
  end
301
301
 
@@ -327,7 +327,7 @@ describe AlohaAnalyzer::User do
327
327
  end
328
328
 
329
329
  it 'starts from the existing analysis' do
330
- subject.should eq(
330
+ expect(subject).to eq(
331
331
  'account_language' => {
332
332
  'count' => 3,
333
333
  'language' => {'abbreviation'=>'en', 'greeting'=>'hello!', 'name'=>'English', 'population'=>239000000, 'countries'=>'USA, UK, Canada, Ireland, Australia'},
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aloha_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Aussaguel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: 3.0.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.14'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.14'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -96,13 +96,18 @@ files:
96
96
  - Rakefile
97
97
  - aloha_analyzer.gemspec
98
98
  - lib/aloha_analyzer.rb
99
+ - lib/aloha_analyzer/base.rb
100
+ - lib/aloha_analyzer/facebook.rb
101
+ - lib/aloha_analyzer/facebook_page.rb
99
102
  - lib/aloha_analyzer/language.rb
100
- - lib/aloha_analyzer/user.rb
103
+ - lib/aloha_analyzer/twitter.rb
101
104
  - lib/aloha_analyzer/version.rb
102
105
  - lib/aloha_analyzer/yaml/aliases.yml
103
106
  - lib/aloha_analyzer/yaml/languages.yml
107
+ - spec/aloha_analyzer/facebook_page_spec.rb
108
+ - spec/aloha_analyzer/facebook_spec.rb
104
109
  - spec/aloha_analyzer/language_spec.rb
105
- - spec/aloha_analyzer/user_spec.rb
110
+ - spec/aloha_analyzer/twitter_spec.rb
106
111
  - spec/aloha_analyzer_spec.rb
107
112
  - spec/spec_helper.rb
108
113
  homepage: https://github.com/matthieua/aloha_analyzer
@@ -130,7 +135,9 @@ signing_key:
130
135
  specification_version: 4
131
136
  summary: Analyze twitter followers languages
132
137
  test_files:
138
+ - spec/aloha_analyzer/facebook_page_spec.rb
139
+ - spec/aloha_analyzer/facebook_spec.rb
133
140
  - spec/aloha_analyzer/language_spec.rb
134
- - spec/aloha_analyzer/user_spec.rb
141
+ - spec/aloha_analyzer/twitter_spec.rb
135
142
  - spec/aloha_analyzer_spec.rb
136
143
  - spec/spec_helper.rb