partisan 0.2.2 → 0.2.3
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/.travis.yml +4 -0
- data/README.md +2 -2
- data/gemfiles/Gemfile.rails-3.2.x +5 -0
- data/gemfiles/Gemfile.rails-4.0 +5 -0
- data/lib/partisan/follower.rb +2 -1
- data/lib/partisan/version.rb +1 -1
- data/spec/{support → partisan}/followable_spec.rb +2 -2
- data/spec/{support → partisan}/follower_spec.rb +8 -7
- data/spec/spec_helper.rb +1 -0
- data/spec/support/macros/rails_macros.rb +9 -0
- metadata +12 -8
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/partisan/follower.rb
CHANGED
@@ -48,11 +48,12 @@ module Partisan
|
|
48
48
|
# @user.following?(@team)
|
49
49
|
#
|
50
50
|
# @return (Boolean)
|
51
|
-
def
|
51
|
+
def follows?(resource)
|
52
52
|
return false if self == resource
|
53
53
|
|
54
54
|
!!fetch_follows(resource).exists?
|
55
55
|
end
|
56
|
+
alias_method :following?, :follows?
|
56
57
|
|
57
58
|
# Get all follows record related to a resource
|
58
59
|
#
|
data/lib/partisan/version.rb
CHANGED
@@ -37,7 +37,7 @@ describe Partisan::Followable do
|
|
37
37
|
|
38
38
|
describe :followers_by_type do
|
39
39
|
it { expect(band.followers_by_type('User').count).to eq 1 }
|
40
|
-
it { expect(band.followers_by_type('User')).to be_an_instance_of(
|
40
|
+
it { expect(band.followers_by_type('User')).to be_an_instance_of(relation_class(User)) }
|
41
41
|
it { expect(band.followers_by_type('User').first).to be_an_instance_of(User) }
|
42
42
|
it { expect(band.followers_by_type('Fan').count).to eq 0 }
|
43
43
|
end
|
@@ -50,7 +50,7 @@ describe Partisan::Followable do
|
|
50
50
|
|
51
51
|
describe :followers_by_type_in_method_missing do
|
52
52
|
it { expect(band.user_followers.count).to eq 1 }
|
53
|
-
it { expect(band.user_followers).to be_an_instance_of(
|
53
|
+
it { expect(band.user_followers).to be_an_instance_of(relation_class(User)) }
|
54
54
|
it { expect(band.user_followers.first).to be_an_instance_of(User) }
|
55
55
|
it { expect(band.fan_followers.count).to eq 0 }
|
56
56
|
end
|
@@ -49,16 +49,16 @@ describe Partisan::Follower do
|
|
49
49
|
it { expect{user.unfollow band}.to change{Partisan::Follow.last}.to(nil) }
|
50
50
|
end
|
51
51
|
|
52
|
-
describe :
|
52
|
+
describe :follows? do
|
53
53
|
let(:band2) { Band.create }
|
54
54
|
|
55
|
-
it { expect(user.
|
56
|
-
it { expect(user.
|
55
|
+
it { expect(user.follows? band).to be_true }
|
56
|
+
it { expect(user.follows? band2).to be_false }
|
57
57
|
end
|
58
58
|
|
59
59
|
describe :following_by_type do
|
60
60
|
it { expect(user.following_by_type('Band').count).to eq 1 }
|
61
|
-
it { expect(user.following_by_type('Band')).to be_an_instance_of(
|
61
|
+
it { expect(user.following_by_type('Band')).to be_an_instance_of(relation_class(Band)) }
|
62
62
|
it { expect(user.following_by_type('Band').first).to be_an_instance_of(Band) }
|
63
63
|
it { expect(user.following_by_type('Concert').count).to eq 0 }
|
64
64
|
end
|
@@ -71,11 +71,11 @@ describe Partisan::Follower do
|
|
71
71
|
|
72
72
|
describe :following_by_type_in_method_missing do
|
73
73
|
it { expect(user.following_bands.count).to eq 1 }
|
74
|
-
it { expect(user.following_bands).to be_an_instance_of(
|
74
|
+
it { expect(user.following_bands).to be_an_instance_of(relation_class(Band)) }
|
75
75
|
it { expect(user.following_bands.first).to be_an_instance_of(Band) }
|
76
76
|
|
77
77
|
it { expect(user.following_concerts.count).to eq 0 }
|
78
|
-
it { expect(user.following_concerts).to be_an_instance_of(
|
78
|
+
it { expect(user.following_concerts).to be_an_instance_of(relation_class(Concert)) }
|
79
79
|
end
|
80
80
|
|
81
81
|
describe :following_fields_by_type_in_method_missing do
|
@@ -153,9 +153,10 @@ describe Partisan::Follower do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
describe :AliasMethods do
|
156
|
-
subject { User.
|
156
|
+
subject { User.new }
|
157
157
|
|
158
158
|
it { should respond_to :start_following }
|
159
159
|
it { should respond_to :stop_following }
|
160
|
+
it { should respond_to :following? }
|
160
161
|
end
|
161
162
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: partisan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -109,6 +109,8 @@ files:
|
|
109
109
|
- LICENSE.md
|
110
110
|
- README.md
|
111
111
|
- Rakefile
|
112
|
+
- gemfiles/Gemfile.rails-3.2.x
|
113
|
+
- gemfiles/Gemfile.rails-4.0
|
112
114
|
- lib/generators/partisan/USAGE
|
113
115
|
- lib/generators/partisan/install_generator.rb
|
114
116
|
- lib/generators/partisan/templates/migration.rb
|
@@ -120,11 +122,12 @@ files:
|
|
120
122
|
- lib/partisan/railtie.rb
|
121
123
|
- lib/partisan/version.rb
|
122
124
|
- partisan.gemspec
|
125
|
+
- spec/partisan/followable_spec.rb
|
126
|
+
- spec/partisan/follower_spec.rb
|
123
127
|
- spec/spec_helper.rb
|
124
|
-
- spec/support/followable_spec.rb
|
125
|
-
- spec/support/follower_spec.rb
|
126
128
|
- spec/support/macros/database_macros.rb
|
127
129
|
- spec/support/macros/model_macros.rb
|
130
|
+
- spec/support/macros/rails_macros.rb
|
128
131
|
homepage: https://github.com/mirego/partisan
|
129
132
|
licenses:
|
130
133
|
- BSD 3-Clause
|
@@ -140,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
143
|
version: '0'
|
141
144
|
segments:
|
142
145
|
- 0
|
143
|
-
hash:
|
146
|
+
hash: 598192539115200308
|
144
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
148
|
none: false
|
146
149
|
requirements:
|
@@ -149,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
152
|
version: '0'
|
150
153
|
segments:
|
151
154
|
- 0
|
152
|
-
hash:
|
155
|
+
hash: 598192539115200308
|
153
156
|
requirements: []
|
154
157
|
rubyforge_project:
|
155
158
|
rubygems_version: 1.8.23
|
@@ -158,8 +161,9 @@ specification_version: 3
|
|
158
161
|
summary: Partisan is a Ruby library that allows ActiveRecord records to be follower
|
159
162
|
and followable
|
160
163
|
test_files:
|
164
|
+
- spec/partisan/followable_spec.rb
|
165
|
+
- spec/partisan/follower_spec.rb
|
161
166
|
- spec/spec_helper.rb
|
162
|
-
- spec/support/followable_spec.rb
|
163
|
-
- spec/support/follower_spec.rb
|
164
167
|
- spec/support/macros/database_macros.rb
|
165
168
|
- spec/support/macros/model_macros.rb
|
169
|
+
- spec/support/macros/rails_macros.rb
|