commendo 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c06ab16ac48b29a9d47748e6b02b5a202faf2ed8
4
- data.tar.gz: 70f8a0e9790b493fa50498026ad79752a9b8530c
3
+ metadata.gz: f4346b4b053e4b910efdd819476fae6e18db6b45
4
+ data.tar.gz: faeee86f961b6e576888accd047b6adfe4dcd54e
5
5
  SHA512:
6
- metadata.gz: 27e4704a857bb1d83a73f5fe2f2069a560bd0f6ca751fea5a8a321b577ffabb673f91505e3ccfde6727768a7312eb561eefea827d5e6f57ae5b14618733675ae
7
- data.tar.gz: 68bc522acf88756c312584955622964361824d1f37c91ba065eb60f55daebef95c52e6c11ed11abe9f97c2a6a7323f8933cb255460be83cd7504452243ebf059
6
+ metadata.gz: ad4356a6a14f35713ab2eee837b69e78e6ed7995c4131968ce8356df45630fc290817a670a2aa29135f02ff9a9a18928437b3a5263c551065912c5689ebb280d
7
+ data.tar.gz: b4db90f586213d1174810081d1e18335572f97c51ca351ffd11f3ea395562b9674781375e2c62d8cc16c0926932dc8479a273e556f38b669acf4f2866250cf9a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.2.4 / 2015-12-09
2
+ * [BUGFIX] Fixed bug with TagSet#empty? reporting empty when only one key present
3
+
1
4
  # 1.2.3 / 2015-10-07
2
5
  * [BUGFIX] Fix exception when calculating similarity on empty resources
3
6
 
@@ -10,7 +10,7 @@ module Commendo
10
10
 
11
11
  def empty?
12
12
  cursor, keys = redis.scan(0, match: "#{key_base}:*", count: 1)
13
- cursor.to_i == 0
13
+ cursor.to_i == 0 && keys.empty?
14
14
  end
15
15
 
16
16
  def get(resource)
@@ -1,3 +1,3 @@
1
1
  module Commendo
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
data/test/tag_set_test.rb CHANGED
@@ -18,9 +18,9 @@ module Commendo
18
18
  def test_adds_tags_for_resource
19
19
  assert_equal [], @ts.get(1)
20
20
  @ts.add(1, 'foo', 'bar', 'baz')
21
- assert_equal ['bar', 'baz','foo'], @ts.get(1)
21
+ assert_equal %w(bar baz foo), @ts.get(1)
22
22
  @ts.add(1, 'qux', 'qip')
23
- assert_equal ['bar', 'baz', 'foo', 'qip', 'qux'], @ts.get(1)
23
+ assert_equal %w(bar baz foo qip qux), @ts.get(1)
24
24
  end
25
25
 
26
26
  def test_empty?
@@ -35,36 +35,36 @@ module Commendo
35
35
  def test_sets_tags_for_resource
36
36
  assert_equal [], @ts.get(1)
37
37
  @ts.set(1, 'foo', 'bar', 'baz')
38
- assert_equal ['bar', 'baz', 'foo'], @ts.get(1)
38
+ assert_equal %w(bar baz foo), @ts.get(1)
39
39
  @ts.set(1, 'qux', 'qip')
40
- assert_equal ['qip', 'qux'], @ts.get(1)
40
+ assert_equal %w(qip qux), @ts.get(1)
41
41
  end
42
42
 
43
43
  def test_sets_tags_when_empty
44
44
  @ts.set(1, 'foo', 'bar', 'baz')
45
45
  @ts.set(2, 'qux', 'qip')
46
- assert_equal ['bar', 'baz', 'foo'], @ts.get(1)
47
- assert_equal ['qip', 'qux'], @ts.get(2)
46
+ assert_equal %w(bar baz foo), @ts.get(1)
47
+ assert_equal %w(qip qux), @ts.get(2)
48
48
  @ts.set(1, *[])
49
49
  assert_equal [], @ts.get(1)
50
- assert_equal ['qip', 'qux'], @ts.get(2)
50
+ assert_equal %w(qip qux), @ts.get(2)
51
51
  end
52
52
 
53
53
  def test_deletes_all_tags_for_resource
54
54
  @ts.set(1, 'foo', 'bar', 'baz')
55
55
  @ts.set(2, 'qux', 'qip')
56
- assert_equal ['bar', 'baz', 'foo'], @ts.get(1)
57
- assert_equal ['qip', 'qux'], @ts.get(2)
56
+ assert_equal %w(bar baz foo), @ts.get(1)
57
+ assert_equal %w(qip qux), @ts.get(2)
58
58
  @ts.delete(1)
59
59
  assert_equal [], @ts.get(1)
60
- assert_equal ['qip', 'qux'], @ts.get(2)
60
+ assert_equal %w(qip qux), @ts.get(2)
61
61
  end
62
62
 
63
63
  def test_deletes_given_tags_for_resource
64
64
  assert_equal [], @ts.get(1)
65
65
  @ts.set(1, 'foo', 'bar', 'baz', 'qux', 'qip')
66
66
  @ts.delete(1, 'qux', 'qip')
67
- assert_equal ['bar', 'baz', 'foo'], @ts.get(1)
67
+ assert_equal %w(bar baz foo), @ts.get(1)
68
68
  end
69
69
 
70
70
  def test_matches_tags
@@ -72,15 +72,15 @@ module Commendo
72
72
  @ts.set(2, 'qux', 'qip')
73
73
 
74
74
  assert @ts.matches(1, ['foo'])
75
- assert @ts.matches(1, ['bar', 'baz'])
76
- assert @ts.matches(1, ['bar', 'baz', 'foo'])
75
+ assert @ts.matches(1, %w(bar baz))
76
+ assert @ts.matches(1, %w(bar baz foo))
77
77
  refute @ts.matches(1, ['qux'])
78
78
  refute @ts.matches(1, ['qip'])
79
79
 
80
80
  refute @ts.matches(2, ['foo'])
81
- refute @ts.matches(2, ['bar', 'baz'])
82
- refute @ts.matches(2, ['bar', 'baz', 'foo'])
83
- assert @ts.matches(2, ['qux', 'qip'])
81
+ refute @ts.matches(2, %w(bar baz))
82
+ refute @ts.matches(2, %w(bar baz foo))
83
+ assert @ts.matches(2, %w(qux qip))
84
84
  assert @ts.matches(2, ['qux'])
85
85
  assert @ts.matches(2, ['qip'])
86
86
  end
@@ -91,16 +91,16 @@ module Commendo
91
91
 
92
92
  refute @ts.matches(1, nil, ['foo'])
93
93
  refute @ts.matches(1, [], ['foo'])
94
- refute @ts.matches(1, [], ['bar', 'baz'])
95
- refute @ts.matches(1, [], ['bar', 'baz', 'foo'])
94
+ refute @ts.matches(1, [], %w(bar baz))
95
+ refute @ts.matches(1, [], %w(bar baz foo))
96
96
  assert @ts.matches(1, [], ['qux'])
97
97
  assert @ts.matches(1, [], ['qip'])
98
98
 
99
99
  assert @ts.matches(2, nil, ['foo'])
100
100
  assert @ts.matches(2, [], ['foo'])
101
- assert @ts.matches(2, [], ['bar', 'baz'])
102
- assert @ts.matches(2, [], ['bar', 'baz', 'foo'])
103
- refute @ts.matches(2, [], ['qux', 'qip'])
101
+ assert @ts.matches(2, [], %w(bar baz))
102
+ assert @ts.matches(2, [], %w(bar baz foo))
103
+ refute @ts.matches(2, [], %w(qux qip))
104
104
  refute @ts.matches(2, [], ['qux'])
105
105
  refute @ts.matches(2, [], ['qip'])
106
106
  end
@@ -117,9 +117,9 @@ module Commendo
117
117
  assert @ts.matches(1, ['foo'], ['qux'])
118
118
 
119
119
  assert @ts.matches(2, ['qip'], ['foo'])
120
- assert @ts.matches(2, ['qux'], ['bar', 'baz'])
121
- assert @ts.matches(2, ['qip'], ['bar', 'baz', 'foo'])
122
- refute @ts.matches(2, ['qip'], ['qux', 'qip'])
120
+ assert @ts.matches(2, ['qux'], %w(bar baz))
121
+ assert @ts.matches(2, ['qip'], %w(bar baz foo))
122
+ refute @ts.matches(2, ['qip'], %w(qux qip))
123
123
  refute @ts.matches(2, ['qip'], ['qux'])
124
124
  refute @ts.matches(2, ['qux'], ['qip'])
125
125
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commendo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Styles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.2.2
167
+ rubygems_version: 2.5.0
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: A Jaccard-similarity recommender using Redis sets