popular 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjJjZmFjNGMzMzc1NGM5YTRiOWY1OGQzY2YwMDEzNzdiYmM3ODA0Ng==
4
+ NjUzMTAyNGMyZGE1ODg0OGE3MzM0ZDQwNGNmOTg1OWE2NjU1MjBhMA==
5
5
  data.tar.gz: !binary |-
6
- YTUzZDc1MjYwMWZkZjk5YWIxZTUzZTg2OWQxNDYzOTgxZGRlZWQyNA==
6
+ ZGJiNThhMDcwM2VmNWFjYzg2Y2I0Y2ZiMGFmOTJhOWQxYTgyYWRhYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGMxNTNlNDBhNGMwZGRiODc1ZTBiODdkNDY5ZWJhMWQ4N2NlNTc4YmU4ZWVl
10
- Nzc3ZTY0MWI4Njc4MzkwOTYzNmZiNzkzZDFjMTgxY2Y3MzVmNTE3OTgyMTI4
11
- OGM2OTQxYjRiMTNkNmFjYzFhMGM4NTZiZTI2MTdkNWIyZmM1YWU=
9
+ OTdlZTM4NTFiNjU5YjI2NDg3MGRlMDY3MDhkMTgyOWExYjQxMzljYWE5NGFm
10
+ ZGJhMmY2MTgzNWQ4ZmM2OWJhYjFhOTNjZmE0NWIxYjVjNmFmNDE4ZmU5NGFh
11
+ NzJiYzliMzQ0YzEzMmE2ODdhYTE3MmU1NzE1ZWIwNmNhMDA3YjY=
12
12
  data.tar.gz: !binary |-
13
- MzU2OTRmMjZkMmZiZmE3MGYyY2Q3ZTRlM2QyODgxNTExYTQ5NWY2OTQxNGQ2
14
- NDUwYzQzYzM4ZDdhMjU0N2Q0OWVlNGRjMzE4YjZlNzEwZmViYmE2MDYwMDA3
15
- NzZhMGRjYTI2YmJlNWZhZWY3ODRhYmNjY2E5ZGMzYmMzOGY2OTM=
13
+ NjFhZDUzZTgyZWVlNmU4NjMwZjk4OTdhMmNkYjdlMmJmYTk4YWRkZGRkNWJk
14
+ NDgxNzUyYmI5MDEzZjJlOTc1NWQ0M2ZkNWNiYTE1YzIwNDc3MWIwMjcwNDA5
15
+ NGY1NzA5MDg0NjljYzM3ZjA4NjAxNDMwZTFjZGVjZjhlNWUxNmY=
data/README.md CHANGED
@@ -152,6 +152,13 @@ If Popular isn't quite what you're looking for, here are some other useful gems
152
152
  Popular was heavily inspired by this screencast: ( http://railscasts.com/episodes/163-self-referential-association?view=asciicast )
153
153
 
154
154
 
155
+ ## Plans for the future
156
+ - Add generator for entire `Frienship` resource that includes FriendshipsController, routes, etc
157
+ - More aliases
158
+ - Define your own `FriendshipProfile` class
159
+ - Callbacks for `befriended` or `followed`
160
+
161
+
155
162
 
156
163
  ## Contributing
157
164
 
@@ -6,6 +6,7 @@ module Popular
6
6
  belongs_to :friend, polymorphic: true
7
7
  has_one :friendship_profile
8
8
 
9
+ validates_uniqueness_of :friend_id, scope: :popular_model_id
9
10
  validates_presence_of :friend, :popular_model
10
11
 
11
12
  # Ensures that popular_models cannot add themselves as a friend
@@ -1,3 +1,3 @@
1
1
  module Popular
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -4,7 +4,7 @@ shared_examples 'a friendship model' do
4
4
  it 'allows for a one-to-one mapping between friendship and a friendship_profile' do
5
5
  friendship = custom_popular_model.befriend another_custom_popular_model
6
6
 
7
- expect( friendship.friendship_profile ).to_not be_nil
7
+ expect( friendship.reload.friendship_profile ).to_not be_nil
8
8
  end
9
9
 
10
10
  it 'model does not get created unless explicitly opted in' do
@@ -29,6 +29,13 @@ shared_examples 'a friendship model' do
29
29
  expect( invalid_model ).to_not be_valid
30
30
  end
31
31
 
32
+ it 'validates uniqueness of friend' do
33
+ popular_model.befriend another_popular_model
34
+ invalid_model = described_class.new popular_model: popular_model, friend: another_popular_model
35
+
36
+ expect( invalid_model ).to_not be_valid
37
+ end
38
+
32
39
  it 'validates presence of friend' do
33
40
  invalid_model = described_class.new popular_model: popular_model
34
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thejchap
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler