party_boy 0.1.1 → 0.1.2
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.
- data/VERSION +1 -1
- data/lib/party_boy.rb +3 -1
- data/party_boy.gemspec +4 -2
- data/spec/models/both_class.rb +7 -0
- data/spec/party_boy_spec.rb +7 -0
- data/spec/schema.rb +4 -0
- metadata +3 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/party_boy.rb
CHANGED
@@ -3,6 +3,7 @@ module Party
|
|
3
3
|
|
4
4
|
class IdentityTheftError < StandardError; end
|
5
5
|
class StalkerError < StandardError; end
|
6
|
+
class TryingTooHardError < StandardError; end
|
6
7
|
|
7
8
|
def self.included(klazz)
|
8
9
|
klazz.extend(Party::Boy::ClassMethods)
|
@@ -14,6 +15,7 @@ module Party
|
|
14
15
|
module ClassMethods
|
15
16
|
|
16
17
|
def acts_as_followable
|
18
|
+
raise(Party::Boy::TryingTooHardError, "Can't implement both acts_as_followable and acts_as_friendly in the same class.") if self.included_modules.include?(Party::Boy::FriendlyInstanceMethods)
|
17
19
|
with_options :class_name => 'Relationship', :dependent => :destroy do |klazz|
|
18
20
|
klazz.has_many :followings, :as => :requestee
|
19
21
|
klazz.has_many :follows, :as => :requestor
|
@@ -23,12 +25,12 @@ module Party
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def acts_as_friend
|
28
|
+
raise(Party::Boy::TryingTooHardError, "Can't implement both acts_as_followable and acts_as_friendly in the same class.") if self.included_modules.include?(Party::Boy::FollowableInstanceMethods)
|
26
29
|
with_options :class_name => 'Relationship', :dependent => :destroy do |klazz|
|
27
30
|
klazz.has_many :outgoing_friendships, :as => :requestor, :include => :requestee
|
28
31
|
klazz.has_many :incoming_friendships, :as => :requestee, :include => :requestor
|
29
32
|
end
|
30
33
|
|
31
|
-
include Party::Boy::RelateableInstanceMethods
|
32
34
|
include Party::Boy::FriendlyInstanceMethods
|
33
35
|
end
|
34
36
|
|
data/party_boy.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{party_boy}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mike Nelson"]
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/party_boy.rb",
|
30
30
|
"party_boy.gemspec",
|
31
31
|
"social_lite.gemspec",
|
32
|
+
"spec/models/both_class.rb",
|
32
33
|
"spec/models/follower_class.rb",
|
33
34
|
"spec/models/friend_class.rb",
|
34
35
|
"spec/party_boy_spec.rb",
|
@@ -42,7 +43,8 @@ Gem::Specification.new do |s|
|
|
42
43
|
s.rubygems_version = %q{1.3.5}
|
43
44
|
s.summary = %q{Models relationships between AR models. Allows you to follow, friend, and block other AR's.}
|
44
45
|
s.test_files = [
|
45
|
-
"spec/models/
|
46
|
+
"spec/models/both_class.rb",
|
47
|
+
"spec/models/follower_class.rb",
|
46
48
|
"spec/models/friend_class.rb",
|
47
49
|
"spec/party_boy_spec.rb",
|
48
50
|
"spec/schema.rb",
|
data/spec/party_boy_spec.rb
CHANGED
@@ -30,6 +30,13 @@ describe "PartyBoy" do
|
|
30
30
|
r3.should_not be_valid
|
31
31
|
end
|
32
32
|
|
33
|
+
|
34
|
+
it "should not allow multiple implementations in one model" do
|
35
|
+
lambda {
|
36
|
+
require 'models/both_class'
|
37
|
+
}.should raise_error(Party::Boy::TryingTooHardError)
|
38
|
+
end
|
39
|
+
|
33
40
|
end
|
34
41
|
|
35
42
|
describe "PartyBoy -- Follower" do
|
data/spec/schema.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: party_boy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/party_boy.rb
|
45
45
|
- party_boy.gemspec
|
46
46
|
- social_lite.gemspec
|
47
|
+
- spec/models/both_class.rb
|
47
48
|
- spec/models/follower_class.rb
|
48
49
|
- spec/models/friend_class.rb
|
49
50
|
- spec/party_boy_spec.rb
|
@@ -79,6 +80,7 @@ signing_key:
|
|
79
80
|
specification_version: 3
|
80
81
|
summary: Models relationships between AR models. Allows you to follow, friend, and block other AR's.
|
81
82
|
test_files:
|
83
|
+
- spec/models/both_class.rb
|
82
84
|
- spec/models/follower_class.rb
|
83
85
|
- spec/models/friend_class.rb
|
84
86
|
- spec/party_boy_spec.rb
|