amico 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -5
- data/README.md +165 -97
- data/lib/amico/relationships.rb +539 -516
- data/lib/amico/version.rb +1 -1
- data/spec/amico/relationships_spec.rb +42 -0
- data/spec/amico/version_spec.rb +1 -1
- data/spec/spec_helper.rb +12 -2
- metadata +24 -15
data/lib/amico/version.rb
CHANGED
@@ -482,6 +482,48 @@ describe Amico::Relationships do
|
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
|
+
describe '#count' do
|
486
|
+
it 'should return the correct count for the various types of relationships' do
|
487
|
+
add_reciprocal_followers(5)
|
488
|
+
|
489
|
+
Amico.count(1, :following).should == 4
|
490
|
+
Amico.count(1, :followers).should == 4
|
491
|
+
Amico.count(1, :reciprocated).should == 4
|
492
|
+
|
493
|
+
Amico.redis.flushdb
|
494
|
+
add_reciprocal_followers(5, true)
|
495
|
+
|
496
|
+
Amico.count(1, :blocked).should == 4
|
497
|
+
|
498
|
+
Amico.redis.flushdb
|
499
|
+
Amico.pending_follow = true
|
500
|
+
add_reciprocal_followers(5)
|
501
|
+
|
502
|
+
Amico.count(1, :pending).should == 4
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
describe '#page_count' do
|
507
|
+
it 'should return the correct page count for the various types of relationships' do
|
508
|
+
add_reciprocal_followers(5)
|
509
|
+
|
510
|
+
Amico.page_count(1, :following).should == 1
|
511
|
+
Amico.page_count(1, :followers).should == 1
|
512
|
+
Amico.page_count(1, :reciprocated).should == 1
|
513
|
+
|
514
|
+
Amico.redis.flushdb
|
515
|
+
add_reciprocal_followers(5, true)
|
516
|
+
|
517
|
+
Amico.page_count(1, :blocked).should == 1
|
518
|
+
|
519
|
+
Amico.redis.flushdb
|
520
|
+
Amico.pending_follow = true
|
521
|
+
add_reciprocal_followers(5)
|
522
|
+
|
523
|
+
Amico.page_count(1, :pending).should == 1
|
524
|
+
end
|
525
|
+
end
|
526
|
+
|
485
527
|
private
|
486
528
|
|
487
529
|
def add_reciprocal_followers(count = 26, block_relationship = false)
|
data/spec/amico/version_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,13 +5,23 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
5
5
|
|
6
6
|
RSpec.configure do |config|
|
7
7
|
config.before(:all) do
|
8
|
+
end
|
9
|
+
|
10
|
+
config.before(:each) do
|
8
11
|
Amico.configure do |configuration|
|
9
12
|
redis = Redis.new(:db => 15)
|
10
13
|
configuration.redis = redis
|
14
|
+
configuration.namespace = 'amico'
|
15
|
+
configuration.following_key = 'following'
|
16
|
+
configuration.followers_key = 'followers'
|
17
|
+
configuration.blocked_key = 'blocked'
|
18
|
+
configuration.reciprocated_key = 'reciprocated'
|
19
|
+
configuration.pending_key = 'pending'
|
20
|
+
configuration.default_scope_key = 'default'
|
21
|
+
configuration.pending_follow = false
|
22
|
+
configuration.page_size = 25
|
11
23
|
end
|
12
|
-
end
|
13
24
|
|
14
|
-
config.before(:each) do
|
15
25
|
Amico.redis.flushdb
|
16
26
|
end
|
17
27
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rspec
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: Relationships (e.g. friendships) backed by Redis
|
48
63
|
email:
|
49
64
|
- dczarnecki@agoragames.com
|
@@ -80,21 +95,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
95
|
- - ! '>='
|
81
96
|
- !ruby/object:Gem::Version
|
82
97
|
version: '0'
|
83
|
-
segments:
|
84
|
-
- 0
|
85
|
-
hash: 1022229374045319322
|
86
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
99
|
none: false
|
88
100
|
requirements:
|
89
101
|
- - ! '>='
|
90
102
|
- !ruby/object:Gem::Version
|
91
103
|
version: '0'
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
hash: 1022229374045319322
|
95
104
|
requirements: []
|
96
105
|
rubyforge_project: amico
|
97
|
-
rubygems_version: 1.8.
|
106
|
+
rubygems_version: 1.8.24
|
98
107
|
signing_key:
|
99
108
|
specification_version: 3
|
100
109
|
summary: Relationships (e.g. friendships) backed by Redis
|