socialization 0.5.0.beta4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -1
- data/lib/socialization.rb +2 -1
- data/lib/socialization/actors/follower.rb +5 -5
- data/lib/socialization/actors/liker.rb +5 -5
- data/lib/socialization/actors/mentioner.rb +5 -5
- data/lib/socialization/lib/exceptions.rb +3 -0
- data/lib/socialization/stores/mixins/follow.rb +4 -4
- data/lib/socialization/stores/mixins/like.rb +4 -4
- data/lib/socialization/stores/mixins/mention.rb +4 -4
- data/lib/socialization/stores/redis/base.rb +3 -1
- data/lib/socialization/version.rb +2 -2
- data/lib/socialization/victims/followable.rb +2 -2
- data/lib/socialization/victims/likeable.rb +2 -2
- data/lib/socialization/victims/mentionable.rb +2 -2
- data/test/actors/follower_test.rb +5 -5
- data/test/actors/liker_test.rb +5 -5
- data/test/actors/mentioner_test.rb +5 -5
- data/test/victims/followable_test.rb +1 -1
- data/test/victims/likeable_test.rb +1 -1
- data/test/victims/mentionable_test.rb +1 -1
- data/test/world_test.rb +3 -3
- metadata +130 -134
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.0 (May 29, 2013)
|
4
|
+
|
5
|
+
* Same as 0.5.0.beta4. Been using it in a very high traffic production environment for over a year and it works.
|
6
|
+
|
3
7
|
## 0.5.0.beta (June 6, 2012)
|
4
8
|
|
5
9
|
* **IMPORTANT:** This release includes many changes, some breaking. Make sure to test your code carefully after upgrading.
|
@@ -12,6 +16,7 @@
|
|
12
16
|
* Added: Data can now be stored in Redis.
|
13
17
|
* Added: `toggle_like!`, `toggle_follow!` and `toggle_mention!` methods. Thanks to [@balvig](https://github.com/balvig).
|
14
18
|
* Added: support for single table inheritance. Thanks to [@balvig](https://github.com/balvig).
|
19
|
+
* Changed: raises Socialization::ArgumentError instead of ::ArgumentError
|
15
20
|
|
16
21
|
## v0.4.0 (February 25, 2012)
|
17
22
|
|
@@ -41,4 +46,4 @@
|
|
41
46
|
|
42
47
|
## 0.1.0 (January 14, 2012)
|
43
48
|
|
44
|
-
* Initial release
|
49
|
+
* Initial release
|
data/lib/socialization.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
%w(
|
2
|
+
lib/*.rb
|
2
3
|
stores/mixins/base.rb
|
3
4
|
stores/mixins/**/*.rb
|
4
5
|
stores/active_record/mixins/base.rb
|
@@ -16,4 +17,4 @@
|
|
16
17
|
Dir["#{File.dirname(__FILE__)}/socialization/#{path}"].each { |f| require(f) }
|
17
18
|
end
|
18
19
|
|
19
|
-
ActiveRecord::Base.send :include, Socialization::ActsAsHelpers
|
20
|
+
ActiveRecord::Base.send :include, Socialization::ActsAsHelpers
|
@@ -27,7 +27,7 @@ module Socialization
|
|
27
27
|
# @param [Followable] followable the object to be followed.
|
28
28
|
# @return [Boolean]
|
29
29
|
def follow!(followable)
|
30
|
-
raise ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
30
|
+
raise Socialization::ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
31
31
|
Socialization.follow_model.follow!(self, followable)
|
32
32
|
end
|
33
33
|
|
@@ -36,7 +36,7 @@ module Socialization
|
|
36
36
|
# @param [Followable] followable the object to unfollow.
|
37
37
|
# @return [Boolean]
|
38
38
|
def unfollow!(followable)
|
39
|
-
raise ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
39
|
+
raise Socialization::ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
40
40
|
Socialization.follow_model.unfollow!(self, followable)
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ module Socialization
|
|
45
45
|
# @param [Followable] followable the object to follow/unfollow.
|
46
46
|
# @return [Boolean]
|
47
47
|
def toggle_follow!(followable)
|
48
|
-
raise ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
48
|
+
raise Socialization::ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
49
49
|
if follows?(followable)
|
50
50
|
unfollow!(followable)
|
51
51
|
false
|
@@ -60,7 +60,7 @@ module Socialization
|
|
60
60
|
# @param [Followable] followable the {Followable} object to test against.
|
61
61
|
# @return [Boolean]
|
62
62
|
def follows?(followable)
|
63
|
-
raise ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
63
|
+
raise Socialization::ArgumentError, "#{followable} is not followable!" unless followable.respond_to?(:is_followable?) && followable.is_followable?
|
64
64
|
Socialization.follow_model.follows?(self, followable)
|
65
65
|
end
|
66
66
|
|
@@ -85,4 +85,4 @@ module Socialization
|
|
85
85
|
alias :followees_relation :followables_relation
|
86
86
|
end
|
87
87
|
end
|
88
|
-
end
|
88
|
+
end
|
@@ -27,7 +27,7 @@ module Socialization
|
|
27
27
|
# @param [Likeable] likeable the object to be liked.
|
28
28
|
# @return [Boolean]
|
29
29
|
def like!(likeable)
|
30
|
-
raise ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
30
|
+
raise Socialization::ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
31
31
|
Socialization.like_model.like!(self, likeable)
|
32
32
|
end
|
33
33
|
|
@@ -36,7 +36,7 @@ module Socialization
|
|
36
36
|
# @param [Likeable] likeable the object to unlike.
|
37
37
|
# @return [Boolean]
|
38
38
|
def unlike!(likeable)
|
39
|
-
raise ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
39
|
+
raise Socialization::ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
40
40
|
Socialization.like_model.unlike!(self, likeable)
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ module Socialization
|
|
45
45
|
# @param [Likeable] likeable the object to like/unlike.
|
46
46
|
# @return [Boolean]
|
47
47
|
def toggle_like!(likeable)
|
48
|
-
raise ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
48
|
+
raise Socialization::ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
49
49
|
if likes?(likeable)
|
50
50
|
unlike!(likeable)
|
51
51
|
false
|
@@ -60,7 +60,7 @@ module Socialization
|
|
60
60
|
# @param [Likeable] likeable the {Likeable} object to test against.
|
61
61
|
# @return [Boolean]
|
62
62
|
def likes?(likeable)
|
63
|
-
raise ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
63
|
+
raise Socialization::ArgumentError, "#{likeable} is not likeable!" unless likeable.respond_to?(:is_likeable?) && likeable.is_likeable?
|
64
64
|
Socialization.like_model.likes?(self, likeable)
|
65
65
|
end
|
66
66
|
|
@@ -85,4 +85,4 @@ module Socialization
|
|
85
85
|
alias :likees_relation :likeables_relation
|
86
86
|
end
|
87
87
|
end
|
88
|
-
end
|
88
|
+
end
|
@@ -27,7 +27,7 @@ module Socialization
|
|
27
27
|
# @param [Mentionable] mentionable the object to be mentioned.
|
28
28
|
# @return [Boolean]
|
29
29
|
def mention!(mentionable)
|
30
|
-
raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
30
|
+
raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
31
31
|
Socialization.mention_model.mention!(self, mentionable)
|
32
32
|
end
|
33
33
|
|
@@ -36,7 +36,7 @@ module Socialization
|
|
36
36
|
# @param [Mentionable] mentionable the object to unmention.
|
37
37
|
# @return [Boolean]
|
38
38
|
def unmention!(mentionable)
|
39
|
-
raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
39
|
+
raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
40
40
|
Socialization.mention_model.unmention!(self, mentionable)
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ module Socialization
|
|
45
45
|
# @param [Mentionable] mentionable the object to mention/unmention.
|
46
46
|
# @return [Boolean]
|
47
47
|
def toggle_mention!(mentionable)
|
48
|
-
raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
48
|
+
raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
49
49
|
if mentions?(mentionable)
|
50
50
|
unmention!(mentionable)
|
51
51
|
false
|
@@ -60,7 +60,7 @@ module Socialization
|
|
60
60
|
# @param [Mentionable] mentionable the {Mentionable} object to test against.
|
61
61
|
# @return [Boolean]
|
62
62
|
def mentions?(mentionable)
|
63
|
-
raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
63
|
+
raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
|
64
64
|
Socialization.mention_model.mentions?(self, mentionable)
|
65
65
|
end
|
66
66
|
|
@@ -85,4 +85,4 @@ module Socialization
|
|
85
85
|
alias :mentionees_relation :mentionables_relation
|
86
86
|
end
|
87
87
|
end
|
88
|
-
end
|
88
|
+
end
|
@@ -8,18 +8,18 @@ module Socialization
|
|
8
8
|
if what.nil?
|
9
9
|
@touch || false
|
10
10
|
else
|
11
|
-
raise ArgumentError unless [:all, :follower, :followable, false, nil].include?(what)
|
11
|
+
raise Socialization::ArgumentError unless [:all, :follower, :followable, false, nil].include?(what)
|
12
12
|
@touch = what
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def after_follow(method)
|
17
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
17
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
18
18
|
@after_create_hook = method
|
19
19
|
end
|
20
20
|
|
21
21
|
def after_unfollow(method)
|
22
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
22
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
23
23
|
@after_destroy_hook = method
|
24
24
|
end
|
25
25
|
|
@@ -36,4 +36,4 @@ module Socialization
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -8,18 +8,18 @@ module Socialization
|
|
8
8
|
if what.nil?
|
9
9
|
@touch || false
|
10
10
|
else
|
11
|
-
raise ArgumentError unless [:all, :liker, :likeable, false, nil].include?(what)
|
11
|
+
raise Socialization::ArgumentError unless [:all, :liker, :likeable, false, nil].include?(what)
|
12
12
|
@touch = what
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def after_like(method)
|
17
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
17
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
18
18
|
@after_create_hook = method
|
19
19
|
end
|
20
20
|
|
21
21
|
def after_unlike(method)
|
22
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
22
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
23
23
|
@after_destroy_hook = method
|
24
24
|
end
|
25
25
|
|
@@ -37,4 +37,4 @@ module Socialization
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
@@ -8,18 +8,18 @@ module Socialization
|
|
8
8
|
if what.nil?
|
9
9
|
@touch || false
|
10
10
|
else
|
11
|
-
raise ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
|
11
|
+
raise Socialization::ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
|
12
12
|
@touch = what
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def after_mention(method)
|
17
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
17
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
18
18
|
@after_create_hook = method
|
19
19
|
end
|
20
20
|
|
21
21
|
def after_unmention(method)
|
22
|
-
raise ArgumentError unless method.is_a?(Symbol) || method.nil?
|
22
|
+
raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
|
23
23
|
@after_destroy_hook = method
|
24
24
|
end
|
25
25
|
|
@@ -37,4 +37,4 @@ module Socialization
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
@@ -8,6 +8,7 @@ module Socialization
|
|
8
8
|
if options[:pluck]
|
9
9
|
Socialization.redis.smembers(generate_forward_key(victim)).inject([]) do |result, element|
|
10
10
|
result << element.match(/\:(\d+)$/)[1] if element.match(/^#{klass}\:/)
|
11
|
+
result
|
11
12
|
end
|
12
13
|
else
|
13
14
|
actors_relation(victim, klass, options).all
|
@@ -28,6 +29,7 @@ module Socialization
|
|
28
29
|
if options[:pluck]
|
29
30
|
Socialization.redis.smembers(generate_backward_key(actor)).inject([]) do |result, element|
|
30
31
|
result << element.match(/\:(\d+)$/)[1] if element.match(/^#{klass}\:/)
|
32
|
+
result
|
31
33
|
end
|
32
34
|
else
|
33
35
|
victims_relation(actor, klass, options).all
|
@@ -90,7 +92,7 @@ module Socialization
|
|
90
92
|
elsif klass.name.match(/Mention$/)
|
91
93
|
['mentioner', 'mentionable']
|
92
94
|
else
|
93
|
-
raise ArgumentError.new("Can't find matching type for #{klass}.")
|
95
|
+
raise Socialization::ArgumentError.new("Can't find matching type for #{klass}.")
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module Socialization
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "1.0.0"
|
3
|
+
end
|
@@ -26,7 +26,7 @@ module Socialization
|
|
26
26
|
#
|
27
27
|
# @return [Boolean]
|
28
28
|
def followed_by?(follower)
|
29
|
-
raise ArgumentError, "#{follower} is not follower!" unless follower.respond_to?(:is_follower?) && follower.is_follower?
|
29
|
+
raise Socialization::ArgumentError, "#{follower} is not follower!" unless follower.respond_to?(:is_follower?) && follower.is_follower?
|
30
30
|
Socialization.follow_model.follows?(follower, self)
|
31
31
|
end
|
32
32
|
|
@@ -47,4 +47,4 @@ module Socialization
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
@@ -26,7 +26,7 @@ module Socialization
|
|
26
26
|
#
|
27
27
|
# @return [Boolean]
|
28
28
|
def liked_by?(liker)
|
29
|
-
raise ArgumentError, "#{liker} is not liker!" unless liker.respond_to?(:is_liker?) && liker.is_liker?
|
29
|
+
raise Socialization::ArgumentError, "#{liker} is not liker!" unless liker.respond_to?(:is_liker?) && liker.is_liker?
|
30
30
|
Socialization.like_model.likes?(liker, self)
|
31
31
|
end
|
32
32
|
|
@@ -48,4 +48,4 @@ module Socialization
|
|
48
48
|
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -26,7 +26,7 @@ module Socialization
|
|
26
26
|
#
|
27
27
|
# @return [Boolean]
|
28
28
|
def mentioned_by?(mentioner)
|
29
|
-
raise ArgumentError, "#{mentioner} is not mentioner!" unless mentioner.respond_to?(:is_mentioner?) && mentioner.is_mentioner?
|
29
|
+
raise Socialization::ArgumentError, "#{mentioner} is not mentioner!" unless mentioner.respond_to?(:is_mentioner?) && mentioner.is_mentioner?
|
30
30
|
Socialization.mention_model.mentions?(mentioner, self)
|
31
31
|
end
|
32
32
|
|
@@ -48,4 +48,4 @@ module Socialization
|
|
48
48
|
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -21,7 +21,7 @@ class FollowerTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#follow!" do
|
23
23
|
should "not accept non-followables" do
|
24
|
-
assert_raise(ArgumentError) { @follower.follow!(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @follower.follow!(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Follow.follow!" do
|
@@ -32,7 +32,7 @@ class FollowerTest < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
context "#unfollow!" do
|
34
34
|
should "not accept non-followables" do
|
35
|
-
assert_raise(ArgumentError) { @follower.unfollow!(:foo) }
|
35
|
+
assert_raise(Socialization::ArgumentError) { @follower.unfollow!(:foo) }
|
36
36
|
end
|
37
37
|
|
38
38
|
should "call $Follow.follow!" do
|
@@ -43,7 +43,7 @@ class FollowerTest < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
context "#toggle_follow!" do
|
45
45
|
should "not accept non-followables" do
|
46
|
-
assert_raise(ArgumentError) { @follower.unfollow!(:foo) }
|
46
|
+
assert_raise(Socialization::ArgumentError) { @follower.unfollow!(:foo) }
|
47
47
|
end
|
48
48
|
|
49
49
|
should "unfollow when following" do
|
@@ -61,7 +61,7 @@ class FollowerTest < Test::Unit::TestCase
|
|
61
61
|
|
62
62
|
context "#follows?" do
|
63
63
|
should "not accept non-followables" do
|
64
|
-
assert_raise(ArgumentError) { @follower.unfollow!(:foo) }
|
64
|
+
assert_raise(Socialization::ArgumentError) { @follower.unfollow!(:foo) }
|
65
65
|
end
|
66
66
|
|
67
67
|
should "call $Follow.follows?" do
|
@@ -111,4 +111,4 @@ class FollowerTest < Test::Unit::TestCase
|
|
111
111
|
end
|
112
112
|
|
113
113
|
end
|
114
|
-
end
|
114
|
+
end
|
data/test/actors/liker_test.rb
CHANGED
@@ -21,7 +21,7 @@ class LikerTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#like!" do
|
23
23
|
should "not accept non-likeables" do
|
24
|
-
assert_raise(ArgumentError) { @liker.like!(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @liker.like!(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Like.like!" do
|
@@ -32,7 +32,7 @@ class LikerTest < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
context "#unlike!" do
|
34
34
|
should "not accept non-likeables" do
|
35
|
-
assert_raise(ArgumentError) { @liker.unlike!(:foo) }
|
35
|
+
assert_raise(Socialization::ArgumentError) { @liker.unlike!(:foo) }
|
36
36
|
end
|
37
37
|
|
38
38
|
should "call $Like.like!" do
|
@@ -43,7 +43,7 @@ class LikerTest < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
context "#toggle_like!" do
|
45
45
|
should "not accept non-likeables" do
|
46
|
-
assert_raise(ArgumentError) { @liker.unlike!(:foo) }
|
46
|
+
assert_raise(Socialization::ArgumentError) { @liker.unlike!(:foo) }
|
47
47
|
end
|
48
48
|
|
49
49
|
should "unlike when likeing" do
|
@@ -61,7 +61,7 @@ class LikerTest < Test::Unit::TestCase
|
|
61
61
|
|
62
62
|
context "#likes?" do
|
63
63
|
should "not accept non-likeables" do
|
64
|
-
assert_raise(ArgumentError) { @liker.unlike!(:foo) }
|
64
|
+
assert_raise(Socialization::ArgumentError) { @liker.unlike!(:foo) }
|
65
65
|
end
|
66
66
|
|
67
67
|
should "call $Like.likes?" do
|
@@ -103,4 +103,4 @@ class LikerTest < Test::Unit::TestCase
|
|
103
103
|
@liker.destroy
|
104
104
|
end
|
105
105
|
end
|
106
|
-
end
|
106
|
+
end
|
@@ -21,7 +21,7 @@ class MentionerTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#mention!" do
|
23
23
|
should "not accept non-mentionables" do
|
24
|
-
assert_raise(ArgumentError) { @mentioner.mention!(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @mentioner.mention!(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Mention.mention!" do
|
@@ -32,7 +32,7 @@ class MentionerTest < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
context "#unmention!" do
|
34
34
|
should "not accept non-mentionables" do
|
35
|
-
assert_raise(ArgumentError) { @mentioner.unmention!(:foo) }
|
35
|
+
assert_raise(Socialization::ArgumentError) { @mentioner.unmention!(:foo) }
|
36
36
|
end
|
37
37
|
|
38
38
|
should "call $Mention.mention!" do
|
@@ -43,7 +43,7 @@ class MentionerTest < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
context "#toggle_mention!" do
|
45
45
|
should "not accept non-mentionables" do
|
46
|
-
assert_raise(ArgumentError) { @mentioner.unmention!(:foo) }
|
46
|
+
assert_raise(Socialization::ArgumentError) { @mentioner.unmention!(:foo) }
|
47
47
|
end
|
48
48
|
|
49
49
|
should "unmention when mentioning" do
|
@@ -61,7 +61,7 @@ class MentionerTest < Test::Unit::TestCase
|
|
61
61
|
|
62
62
|
context "#mentions?" do
|
63
63
|
should "not accept non-mentionables" do
|
64
|
-
assert_raise(ArgumentError) { @mentioner.unmention!(:foo) }
|
64
|
+
assert_raise(Socialization::ArgumentError) { @mentioner.unmention!(:foo) }
|
65
65
|
end
|
66
66
|
|
67
67
|
should "call $Mention.mentions?" do
|
@@ -103,4 +103,4 @@ class MentionerTest < Test::Unit::TestCase
|
|
103
103
|
@mentioner.destroy
|
104
104
|
end
|
105
105
|
end
|
106
|
-
end
|
106
|
+
end
|
@@ -21,7 +21,7 @@ class FollowableTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#followed_by?" do
|
23
23
|
should "not accept non-followers" do
|
24
|
-
assert_raise(ArgumentError) { @followable.followed_by?(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @followable.followed_by?(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Follow.follows?" do
|
@@ -21,7 +21,7 @@ class LikeableTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#liked_by?" do
|
23
23
|
should "not accept non-likers" do
|
24
|
-
assert_raise(ArgumentError) { @likeable.liked_by?(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @likeable.liked_by?(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Like.likes?" do
|
@@ -21,7 +21,7 @@ class MentionableTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
context "#mentioned_by?" do
|
23
23
|
should "not accept non-mentioners" do
|
24
|
-
assert_raise(ArgumentError) { @mentionable.mentioned_by?(:foo) }
|
24
|
+
assert_raise(Socialization::ArgumentError) { @mentionable.mentioned_by?(:foo) }
|
25
25
|
end
|
26
26
|
|
27
27
|
should "call $Mention.mentions?" do
|
data/test/world_test.rb
CHANGED
@@ -56,11 +56,11 @@ class WorldTest < Test::Unit::TestCase
|
|
56
56
|
assert camilo.follows?(carl)
|
57
57
|
assert !carl.follows?(camilo)
|
58
58
|
|
59
|
-
assert_raise ArgumentError do
|
59
|
+
assert_raise Socialization::ArgumentError do
|
60
60
|
john.like!(travolta) # Can't like a Celeb
|
61
61
|
end
|
62
62
|
|
63
|
-
assert_raise ArgumentError do
|
63
|
+
assert_raise Socialization::ArgumentError do
|
64
64
|
john.follow!(kill_bill) # Can't follow a movie
|
65
65
|
end
|
66
66
|
|
@@ -109,4 +109,4 @@ class WorldTest < Test::Unit::TestCase
|
|
109
109
|
super
|
110
110
|
end
|
111
111
|
|
112
|
-
end
|
112
|
+
end
|
metadata
CHANGED
@@ -1,146 +1,153 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialization
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 0
|
10
|
-
- beta
|
11
|
-
- 4
|
12
|
-
version: 0.5.0.beta4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Carl Mercier
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
none: false
|
24
21
|
name: activerecord
|
22
|
+
type: :runtime
|
25
23
|
prerelease: false
|
26
|
-
requirement:
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
27
36
|
none: false
|
28
|
-
requirements:
|
29
|
-
- - ">="
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 3
|
32
|
-
segments:
|
33
|
-
- 0
|
34
|
-
version: "0"
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
37
|
name: appraisal
|
38
|
+
type: :development
|
39
39
|
prerelease: false
|
40
|
-
requirement:
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
41
52
|
none: false
|
42
|
-
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 3
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
version: "0"
|
49
|
-
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
53
|
name: logger
|
54
|
+
type: :development
|
53
55
|
prerelease: false
|
54
|
-
requirement:
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
none: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
55
68
|
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
69
|
name: mocha
|
70
|
+
type: :development
|
67
71
|
prerelease: false
|
68
|
-
requirement:
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
none: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
69
84
|
none: false
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
hash: 3
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
77
|
-
type: :development
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
85
|
name: shoulda
|
86
|
+
type: :development
|
81
87
|
prerelease: false
|
82
|
-
requirement:
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
none: false
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
83
100
|
none: false
|
84
|
-
requirements:
|
85
|
-
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
hash: 3
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
-
type: :development
|
92
|
-
version_requirements: *id005
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
101
|
name: sqlite3
|
102
|
+
type: :development
|
95
103
|
prerelease: false
|
96
|
-
requirement:
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
none: false
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
97
116
|
none: false
|
98
|
-
requirements:
|
99
|
-
- - ">="
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
hash: 3
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
type: :development
|
106
|
-
version_requirements: *id006
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
117
|
name: yard
|
118
|
+
type: :development
|
109
119
|
prerelease: false
|
110
|
-
requirement:
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
none: false
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
111
132
|
none: false
|
112
|
-
requirements:
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
hash: 3
|
116
|
-
segments:
|
117
|
-
- 0
|
118
|
-
version: "0"
|
119
|
-
type: :development
|
120
|
-
version_requirements: *id007
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
133
|
name: mock_redis
|
134
|
+
type: :development
|
123
135
|
prerelease: false
|
124
|
-
requirement:
|
136
|
+
requirement: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
125
141
|
none: false
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
segments:
|
131
|
-
- 0
|
132
|
-
version: "0"
|
133
|
-
type: :development
|
134
|
-
version_requirements: *id008
|
135
|
-
description: Socialization allows any model to Follow and/or Like any other model. This is accomplished through a double polymorphic relationship on the Follow and Like models. But you don't need to know that since all the complexity is hidden from you.
|
142
|
+
description: Socialization allows any model to Follow and/or Like any other model.
|
143
|
+
This is accomplished through a double polymorphic relationship on the Follow and
|
144
|
+
Like models. But you don't need to know that since all the complexity is hidden
|
145
|
+
from you.
|
136
146
|
email: carl@carlmercier.com
|
137
147
|
executables: []
|
138
|
-
|
139
148
|
extensions: []
|
140
|
-
|
141
149
|
extra_rdoc_files: []
|
142
|
-
|
143
|
-
files:
|
150
|
+
files:
|
144
151
|
- .gitignore
|
145
152
|
- .travis.yml
|
146
153
|
- Appraisals
|
@@ -235,6 +242,7 @@ files:
|
|
235
242
|
- lib/socialization/config/config.rb
|
236
243
|
- lib/socialization/helpers/acts_as_helpers.rb
|
237
244
|
- lib/socialization/helpers/string.rb
|
245
|
+
- lib/socialization/lib/exceptions.rb
|
238
246
|
- lib/socialization/stores/active_record/follow.rb
|
239
247
|
- lib/socialization/stores/active_record/like.rb
|
240
248
|
- lib/socialization/stores/active_record/mention.rb
|
@@ -271,43 +279,31 @@ files:
|
|
271
279
|
- test/victims/likeable_test.rb
|
272
280
|
- test/victims/mentionable_test.rb
|
273
281
|
- test/world_test.rb
|
274
|
-
has_rdoc: false
|
275
282
|
homepage: https://github.com/cmer/socialization
|
276
283
|
licenses: []
|
277
|
-
|
278
284
|
post_install_message:
|
279
285
|
rdoc_options: []
|
280
|
-
|
281
|
-
require_paths:
|
286
|
+
require_paths:
|
282
287
|
- lib
|
283
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
288
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ! '>='
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
284
293
|
none: false
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
- 0
|
291
|
-
version: "0"
|
292
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
|
+
requirements:
|
296
|
+
- - ! '>='
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '0'
|
293
299
|
none: false
|
294
|
-
requirements:
|
295
|
-
- - ">"
|
296
|
-
- !ruby/object:Gem::Version
|
297
|
-
hash: 25
|
298
|
-
segments:
|
299
|
-
- 1
|
300
|
-
- 3
|
301
|
-
- 1
|
302
|
-
version: 1.3.1
|
303
300
|
requirements: []
|
304
|
-
|
305
301
|
rubyforge_project:
|
306
|
-
rubygems_version: 1.
|
302
|
+
rubygems_version: 1.8.23
|
307
303
|
signing_key:
|
308
304
|
specification_version: 3
|
309
305
|
summary: Easily socialize your app with Likes and Follows
|
310
|
-
test_files:
|
306
|
+
test_files:
|
311
307
|
- test/actors/follower_test.rb
|
312
308
|
- test/actors/liker_test.rb
|
313
309
|
- test/actors/mentioner_test.rb
|