acts_as_follower 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -92,7 +92,7 @@ You can check to see if an object that acts_as_follower is following another obj
|
|
92
92
|
user.following?(book) # Returns true or false
|
93
93
|
|
94
94
|
To get the total number (count) of follows for a user use the following on a model that acts_as_follower
|
95
|
-
user.follow_count # Returns
|
95
|
+
user.follow_count # Returns an integer
|
96
96
|
|
97
97
|
To get follow records that have not been blocked use the following
|
98
98
|
user.all_follows # returns an array of Follow records
|
data/acts_as_follower.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = "https://github.com/tcocca/acts_as_follower"
|
11
11
|
s.summary = %q{A Rubygem to add Follow functionality for ActiveRecord models}
|
12
12
|
s.description = %q{acts_as_follower is a Rubygem to allow any model to follow any other model. This is accomplished through a double polymorphic relationship on the Follow model. There is also built in support for blocking/un-blocking follow records. Main uses would be for Users to follow other Users or for Users to follow Books, etc… (Basically, to develop the type of follow system that GitHub has)}
|
13
|
+
s.license = 'MIT'
|
13
14
|
|
14
15
|
s.rubyforge_project = "acts_as_follower"
|
15
16
|
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |s|
|
|
20
21
|
|
21
22
|
s.add_development_dependency "sqlite3"
|
22
23
|
s.add_development_dependency "shoulda_create"
|
23
|
-
s.add_development_dependency "shoulda", "3.5.0"
|
24
|
-
s.add_development_dependency "factory_girl", "4.2.0"
|
24
|
+
s.add_development_dependency "shoulda", ">= 3.5.0"
|
25
|
+
s.add_development_dependency "factory_girl", ">= 4.2.0"
|
25
26
|
s.add_development_dependency "rails", "~> 4.0.0"
|
26
27
|
end
|
@@ -97,6 +97,10 @@ module ActsAsFollower #:nodoc:
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
def respond_to?(m, include_private = false)
|
101
|
+
super || m.to_s[/following_(.+)_count/] || m.to_s[/following_(.+)/]
|
102
|
+
end
|
103
|
+
|
100
104
|
# Returns a follow record for the current instance and followable object.
|
101
105
|
def get_follow(followable)
|
102
106
|
self.follows.unblocked.for_followable(followable).first
|
@@ -251,6 +251,18 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
|
|
251
251
|
assert_equal 1, @oasis.count_user_followers
|
252
252
|
end
|
253
253
|
end
|
254
|
+
|
255
|
+
context "respond_to?" do
|
256
|
+
should "advertise that it responds to following methods" do
|
257
|
+
assert @oasis.respond_to?(:user_followers)
|
258
|
+
assert @oasis.respond_to?(:user_followers_count)
|
259
|
+
end
|
260
|
+
|
261
|
+
should "return false when called with a nonexistent method" do
|
262
|
+
assert (not @oasis.respond_to?(:foobar))
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
254
266
|
end
|
255
267
|
|
256
268
|
end
|
@@ -173,6 +173,17 @@ class ActsAsFollowerTest < ActiveSupport::TestCase
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
+
context "respond_to?" do
|
177
|
+
should "advertise that it responds to following methods" do
|
178
|
+
assert @sam.respond_to?(:following_users)
|
179
|
+
assert @sam.respond_to?(:following_users_count)
|
180
|
+
end
|
181
|
+
|
182
|
+
should "return false when called with a nonexistent method" do
|
183
|
+
assert (not @sam.respond_to?(:foobar))
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
176
187
|
context "destroying follower" do
|
177
188
|
setup do
|
178
189
|
@jon.destroy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_follower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- - '
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 3.5.0
|
54
54
|
type: :development
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- - '
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.5.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- - '
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 4.2.0
|
70
70
|
type: :development
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- - '
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 4.2.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
@@ -147,7 +147,8 @@ files:
|
|
147
147
|
- test/schema.rb
|
148
148
|
- test/test_helper.rb
|
149
149
|
homepage: https://github.com/tcocca/acts_as_follower
|
150
|
-
licenses:
|
150
|
+
licenses:
|
151
|
+
- MIT
|
151
152
|
post_install_message:
|
152
153
|
rdoc_options: []
|
153
154
|
require_paths:
|
@@ -160,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
161
|
version: '0'
|
161
162
|
segments:
|
162
163
|
- 0
|
163
|
-
hash:
|
164
|
+
hash: 2161870753615242335
|
164
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
166
|
none: false
|
166
167
|
requirements:
|
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
version: '0'
|
170
171
|
segments:
|
171
172
|
- 0
|
172
|
-
hash:
|
173
|
+
hash: 2161870753615242335
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project: acts_as_follower
|
175
176
|
rubygems_version: 1.8.26
|