aloha_analyzer 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef74babf1f476d54991db96d7037a33b4ae682f0
4
- data.tar.gz: b35b6e264346d2ad56c9d5f7df1ba276905d9212
3
+ metadata.gz: 81caaf5420375cdbb424f316716b7789ffa83138
4
+ data.tar.gz: 5f267b646594467a59facb34c9787b20819f3325
5
5
  SHA512:
6
- metadata.gz: 58fa95446a8e3d340f4b1a6320e2dc1690e683982c20be6134810a8a12459618cced954822d8f25ab7d6e4a2e490f3b30212048511b60b945d1f15af96677498
7
- data.tar.gz: fc197b9e40eef6c933457720b3586ecf1a52196480f0032e1d2900c7225ecf1f9c9cf4346a68463918766b61f3f89cc01f082f9d0ae7e543e9d1ce5f12c536f7
6
+ metadata.gz: 45fd99434b3e05ddabc6b8a9a722421789459be9154d249d1b4909bad1b370bc3b1e9fac8f390e241261f8571eb24cfa6728dcbb85cca6f97703cf45d79a520f
7
+ data.tar.gz: 8de8bd977aa9179de77d1b7d38f362088a1f42ed0984168566440fcd18ff7ff2d58eaf8a692c8e5574cd6f789dd3dea56a2dbd2a0ef4bf4ac045aaf2f258c81a
@@ -6,7 +6,7 @@ module AlohaAnalyzer
6
6
  def initialize(options)
7
7
  @language = clean_language(options['language'].downcase)
8
8
  @users = clean_users(options['users'])
9
- @analysis = options['analysis'] || boilerplate
9
+ @analysis = (options['analysis'] || boilerplate).clone
10
10
  @options = options
11
11
  end
12
12
 
@@ -24,6 +24,19 @@ module AlohaAnalyzer
24
24
  @analysis
25
25
  end
26
26
 
27
+ def boilerplate
28
+ {
29
+ 'account_language' => {
30
+ 'count' => 0,
31
+ 'language' => Language.find_by_abbreviation(@language),
32
+ 'users' => []
33
+ },
34
+ 'foreign_languages_count' => 0,
35
+ 'count' => 0,
36
+ 'foreign_languages' => {}
37
+ }
38
+ end
39
+
27
40
  private
28
41
 
29
42
  def add_account_language_user(user)
@@ -50,19 +63,6 @@ module AlohaAnalyzer
50
63
  end
51
64
  end
52
65
 
53
- def boilerplate
54
- {
55
- 'account_language' => {
56
- 'count' => 0,
57
- 'language' => Language.find_by_abbreviation(@language),
58
- 'users' => []
59
- },
60
- 'foreign_languages_count' => 0,
61
- 'count' => 0,
62
- 'foreign_languages' => {}
63
- }
64
- end
65
-
66
66
  def too_many_users?(users)
67
67
  if @options['max_users'] && users.size >= @options['max_users']
68
68
  true
@@ -1,3 +1,3 @@
1
1
  module AlohaAnalyzer
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -40,11 +40,27 @@ describe AlohaAnalyzer::User do
40
40
  end
41
41
 
42
42
  context 'when analysis is not nil' do
43
- let(:analysis) { double }
43
+ let(:analysis) { { foo: :bar } }
44
44
 
45
45
  it 'sets the analysis to the argument' do
46
46
  subject.analysis.should eq analysis
47
47
  end
48
+
49
+ it 'clones the hash' do
50
+ subject.analysis.object_id.should_not eq analysis.object_id
51
+ end
52
+ end
53
+
54
+ context 'when analysis is nil' do
55
+ let(:analysis) { nil }
56
+
57
+ it 'sets the analysis to the analysis boilerplate' do
58
+ subject.analysis.should eq subject.boilerplate
59
+ end
60
+
61
+ it 'clones the hash' do
62
+ subject.analysis.object_id.should_not eq subject.boilerplate.object_id
63
+ end
48
64
  end
49
65
  end
50
66
 
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.3.0
4
+ version: 0.3.1
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-05-16 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler