social_stream-base 0.19.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,11 @@ SocialStream.setup do |config|
27
27
  # :follow - user just follow other users, like Twitter
28
28
  #
29
29
  # config.relation_model = :custom
30
-
30
+
31
+ # Expose resque interface to manage background tasks at /resque
32
+ #
33
+ # config.resque_access = true
34
+
31
35
  # Quick search (header) and Extended search models and its order. Remember to create
32
36
  # the indexes with thinking-sphinx if you are using customized models.
33
37
  #
@@ -20,6 +20,10 @@ Factory.define :reject, :parent => :tie do |t|
20
20
  t.after_build { |u| u.relation = Relation::Reject.instance }
21
21
  end
22
22
 
23
+ Factory.define :follow, :parent => :tie do |t|
24
+ t.after_build { |u| u.relation = Relation::Follow.instance }
25
+ end
26
+
23
27
  # Group ties
24
28
  Factory.define :g2u_tie, :parent => :tie do |t|
25
29
  t.contact { |c| Factory(:group_contact) }
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ResqueAccess" do
4
+ context "with config enabled" do
5
+ before do
6
+ SocialStream.resque_access = true
7
+ end
8
+
9
+ it "should be success" do
10
+ get '/resque/overview'
11
+
12
+ response.should be_success
13
+ end
14
+ end
15
+
16
+ context "with config disabled" do
17
+ before do
18
+ SocialStream.resque_access = false
19
+ end
20
+
21
+ it "should be success" do
22
+ begin
23
+ get '/resque/overview'
24
+ assert false
25
+ rescue ActionController::RoutingError
26
+ assert true
27
+ end
28
+ end
29
+ end
30
+ end
@@ -32,32 +32,81 @@ describe Post do
32
32
  end
33
33
 
34
34
  context "without relations" do
35
- it "should allow create to friend" do
36
- tie = Factory(:friend)
35
+ before :all do
36
+ @ss_relation_model = SocialStream.relation_model
37
+ end
38
+
39
+ after :all do
40
+ SocialStream.relation_model = @ss_relation_model
41
+ end
42
+
43
+ context "in follow relation model" do
44
+ before do
45
+ SocialStream.relation_model = :follow
46
+ end
47
+
48
+ it "should allow create to follower" do
49
+ tie = Factory(:follow)
50
+
51
+ post = Post.new :text => "testing",
52
+ :author_id => tie.receiver.id,
53
+ :owner_id => tie.sender.id,
54
+ :user_author_id => tie.receiver.id
55
+
56
+ assert post.build_post_activity.allow? tie.receiver_subject, 'create'
57
+
58
+ ability = Ability.new(tie.receiver_subject)
59
+
60
+ ability.should be_able_to(:create, post)
61
+ end
37
62
 
38
- post = Post.new :text => "testing",
39
- :author_id => tie.receiver.id,
40
- :owner_id => tie.sender.id,
41
- :user_author_id => tie.receiver.id
63
+ it "should fill relation" do
64
+ tie = Factory(:follow)
42
65
 
43
- assert post.build_post_activity.allow? tie.receiver_subject, 'create'
66
+ post = Post.new :text => "testing",
67
+ :author_id => tie.receiver.id,
68
+ :owner_id => tie.sender.id,
69
+ :user_author_id => tie.receiver.id
44
70
 
45
- ability = Ability.new(tie.receiver_subject)
71
+ post.save!
72
+
73
+ post.post_activity.relations.should include(Relation::Public.instance)
74
+ end
46
75
 
47
- ability.should be_able_to(:create, post)
48
76
  end
49
77
 
50
- it "should fill relation" do
51
- tie = Factory(:friend)
78
+ context "in custom relation model" do
79
+ before do
80
+ SocialStream.relation_model = :custom
81
+ end
82
+
83
+ it "should allow create to friend" do
84
+ tie = Factory(:friend)
85
+
86
+ post = Post.new :text => "testing",
87
+ :author_id => tie.receiver.id,
88
+ :owner_id => tie.sender.id,
89
+ :user_author_id => tie.receiver.id
52
90
 
53
- post = Post.new :text => "testing",
54
- :author_id => tie.receiver.id,
55
- :owner_id => tie.sender.id,
56
- :user_author_id => tie.receiver.id
91
+ assert post.build_post_activity.allow? tie.receiver_subject, 'create'
57
92
 
58
- post.save!
93
+ ability = Ability.new(tie.receiver_subject)
59
94
 
60
- post.post_activity.relations.should include(tie.relation)
95
+ ability.should be_able_to(:create, post)
96
+ end
97
+
98
+ it "should fill relation" do
99
+ tie = Factory(:friend)
100
+
101
+ post = Post.new :text => "testing",
102
+ :author_id => tie.receiver.id,
103
+ :owner_id => tie.sender.id,
104
+ :user_author_id => tie.receiver.id
105
+
106
+ post.save!
107
+
108
+ post.post_activity.relations.should include(tie.relation)
109
+ end
61
110
  end
62
111
  end
63
112
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.19.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-03 00:00:00.000000000Z
13
+ date: 2012-04-11 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &82053200 !ruby/object:Gem::Requirement
17
+ requirement: &70579860 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *82053200
25
+ version_requirements: *70579860
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: ancestry
28
- requirement: &82052710 !ruby/object:Gem::Requirement
28
+ requirement: &70578930 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.2.3
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *82052710
36
+ version_requirements: *70578930
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: foreigner
39
- requirement: &82052290 !ruby/object:Gem::Requirement
39
+ requirement: &70577950 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.1.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *82052290
47
+ version_requirements: *70577950
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: devise
50
- requirement: &82051510 !ruby/object:Gem::Requirement
50
+ requirement: &70574700 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.5.3
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *82051510
58
+ version_requirements: *70574700
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: inherited_resources
61
- requirement: &82051160 !ruby/object:Gem::Requirement
61
+ requirement: &70573480 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.3.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *82051160
69
+ version_requirements: *70573480
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: stringex
72
- requirement: &82050870 !ruby/object:Gem::Requirement
72
+ requirement: &70572580 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.3.0
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *82050870
80
+ version_requirements: *70572580
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: avatars_for_rails
83
- requirement: &82050490 !ruby/object:Gem::Requirement
83
+ requirement: &70571860 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 0.2.5
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *82050490
91
+ version_requirements: *70571860
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: jquery-rails
94
- requirement: &82050240 !ruby/object:Gem::Requirement
94
+ requirement: &70570810 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 1.0.9
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *82050240
102
+ version_requirements: *70570810
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: cancan
105
- requirement: &82049940 !ruby/object:Gem::Requirement
105
+ requirement: &70569990 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 1.6.4
111
111
  type: :runtime
112
112
  prerelease: false
113
- version_requirements: *82049940
113
+ version_requirements: *70569990
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: kaminari
116
- requirement: &82049530 !ruby/object:Gem::Requirement
116
+ requirement: &70550640 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ~>
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 0.13.0
122
122
  type: :runtime
123
123
  prerelease: false
124
- version_requirements: *82049530
124
+ version_requirements: *70550640
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: omniauth
127
- requirement: &82049140 !ruby/object:Gem::Requirement
127
+ requirement: &70535050 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ~>
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: 1.0.2
133
133
  type: :runtime
134
134
  prerelease: false
135
- version_requirements: *82049140
135
+ version_requirements: *70535050
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: omniauth-facebook
138
- requirement: &82048660 !ruby/object:Gem::Requirement
138
+ requirement: &70516810 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ~>
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: 1.2.0
144
144
  type: :runtime
145
145
  prerelease: false
146
- version_requirements: *82048660
146
+ version_requirements: *70516810
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: omniauth-linkedin
149
- requirement: &82048060 !ruby/object:Gem::Requirement
149
+ requirement: &70478590 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ~>
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: 0.0.6
155
155
  type: :runtime
156
156
  prerelease: false
157
- version_requirements: *82048060
157
+ version_requirements: *70478590
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: mailboxer
160
- requirement: &80850010 !ruby/object:Gem::Requirement
160
+ requirement: &70462090 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ~>
@@ -165,10 +165,10 @@ dependencies:
165
165
  version: 0.6.5
166
166
  type: :runtime
167
167
  prerelease: false
168
- version_requirements: *80850010
168
+ version_requirements: *70462090
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: acts-as-taggable-on
171
- requirement: &80847300 !ruby/object:Gem::Requirement
171
+ requirement: &70455800 !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements:
174
174
  - - ~>
@@ -176,10 +176,10 @@ dependencies:
176
176
  version: 2.2.2
177
177
  type: :runtime
178
178
  prerelease: false
179
- version_requirements: *80847300
179
+ version_requirements: *70455800
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: formtastic
182
- requirement: &80845980 !ruby/object:Gem::Requirement
182
+ requirement: &70441270 !ruby/object:Gem::Requirement
183
183
  none: false
184
184
  requirements:
185
185
  - - ~>
@@ -187,10 +187,10 @@ dependencies:
187
187
  version: 1.2.3
188
188
  type: :runtime
189
189
  prerelease: false
190
- version_requirements: *80845980
190
+ version_requirements: *70441270
191
191
  - !ruby/object:Gem::Dependency
192
192
  name: resque
193
- requirement: &80836730 !ruby/object:Gem::Requirement
193
+ requirement: &70424240 !ruby/object:Gem::Requirement
194
194
  none: false
195
195
  requirements:
196
196
  - - ~>
@@ -198,10 +198,10 @@ dependencies:
198
198
  version: 1.20.0
199
199
  type: :runtime
200
200
  prerelease: false
201
- version_requirements: *80836730
201
+ version_requirements: *70424240
202
202
  - !ruby/object:Gem::Dependency
203
203
  name: modernizr-rails
204
- requirement: &80834710 !ruby/object:Gem::Requirement
204
+ requirement: &70418210 !ruby/object:Gem::Requirement
205
205
  none: false
206
206
  requirements:
207
207
  - - ~>
@@ -209,10 +209,10 @@ dependencies:
209
209
  version: 2.0.6
210
210
  type: :runtime
211
211
  prerelease: false
212
- version_requirements: *80834710
212
+ version_requirements: *70418210
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: thinking-sphinx
215
- requirement: &80832000 !ruby/object:Gem::Requirement
215
+ requirement: &70399320 !ruby/object:Gem::Requirement
216
216
  none: false
217
217
  requirements:
218
218
  - - ~>
@@ -220,10 +220,10 @@ dependencies:
220
220
  version: 2.0.8
221
221
  type: :runtime
222
222
  prerelease: false
223
- version_requirements: *80832000
223
+ version_requirements: *70399320
224
224
  - !ruby/object:Gem::Dependency
225
225
  name: sass-rails
226
- requirement: &80830520 !ruby/object:Gem::Requirement
226
+ requirement: &70397610 !ruby/object:Gem::Requirement
227
227
  none: false
228
228
  requirements:
229
229
  - - ! '>='
@@ -231,10 +231,10 @@ dependencies:
231
231
  version: 3.1.0
232
232
  type: :runtime
233
233
  prerelease: false
234
- version_requirements: *80830520
234
+ version_requirements: *70397610
235
235
  - !ruby/object:Gem::Dependency
236
236
  name: rails_autolink
237
- requirement: &80827690 !ruby/object:Gem::Requirement
237
+ requirement: &70395670 !ruby/object:Gem::Requirement
238
238
  none: false
239
239
  requirements:
240
240
  - - ~>
@@ -242,10 +242,10 @@ dependencies:
242
242
  version: 1.0.4
243
243
  type: :runtime
244
244
  prerelease: false
245
- version_requirements: *80827690
245
+ version_requirements: *70395670
246
246
  - !ruby/object:Gem::Dependency
247
247
  name: social_cheesecake
248
- requirement: &80826760 !ruby/object:Gem::Requirement
248
+ requirement: &70393090 !ruby/object:Gem::Requirement
249
249
  none: false
250
250
  requirements:
251
251
  - - ~>
@@ -253,10 +253,10 @@ dependencies:
253
253
  version: 0.4.0
254
254
  type: :runtime
255
255
  prerelease: false
256
- version_requirements: *80826760
256
+ version_requirements: *70393090
257
257
  - !ruby/object:Gem::Dependency
258
258
  name: i18n-js
259
- requirement: &80824260 !ruby/object:Gem::Requirement
259
+ requirement: &70386590 !ruby/object:Gem::Requirement
260
260
  none: false
261
261
  requirements:
262
262
  - - ~>
@@ -264,10 +264,10 @@ dependencies:
264
264
  version: 2.1.2
265
265
  type: :runtime
266
266
  prerelease: false
267
- version_requirements: *80824260
267
+ version_requirements: *70386590
268
268
  - !ruby/object:Gem::Dependency
269
269
  name: capybara
270
- requirement: &80822270 !ruby/object:Gem::Requirement
270
+ requirement: &70383160 !ruby/object:Gem::Requirement
271
271
  none: false
272
272
  requirements:
273
273
  - - ~>
@@ -275,10 +275,10 @@ dependencies:
275
275
  version: 0.3.9
276
276
  type: :development
277
277
  prerelease: false
278
- version_requirements: *80822270
278
+ version_requirements: *70383160
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: sqlite3-ruby
281
- requirement: &80820130 !ruby/object:Gem::Requirement
281
+ requirement: &70365160 !ruby/object:Gem::Requirement
282
282
  none: false
283
283
  requirements:
284
284
  - - ! '>='
@@ -286,10 +286,10 @@ dependencies:
286
286
  version: '0'
287
287
  type: :development
288
288
  prerelease: false
289
- version_requirements: *80820130
289
+ version_requirements: *70365160
290
290
  - !ruby/object:Gem::Dependency
291
291
  name: ruby-debug19
292
- requirement: &80802380 !ruby/object:Gem::Requirement
292
+ requirement: &70362610 !ruby/object:Gem::Requirement
293
293
  none: false
294
294
  requirements:
295
295
  - - ! '>='
@@ -297,10 +297,10 @@ dependencies:
297
297
  version: '0'
298
298
  type: :development
299
299
  prerelease: false
300
- version_requirements: *80802380
300
+ version_requirements: *70362610
301
301
  - !ruby/object:Gem::Dependency
302
302
  name: rspec-rails
303
- requirement: &80800060 !ruby/object:Gem::Requirement
303
+ requirement: &70361030 !ruby/object:Gem::Requirement
304
304
  none: false
305
305
  requirements:
306
306
  - - ~>
@@ -308,10 +308,10 @@ dependencies:
308
308
  version: 2.6.1
309
309
  type: :development
310
310
  prerelease: false
311
- version_requirements: *80800060
311
+ version_requirements: *70361030
312
312
  - !ruby/object:Gem::Dependency
313
313
  name: factory_girl
314
- requirement: &80798980 !ruby/object:Gem::Requirement
314
+ requirement: &70359470 !ruby/object:Gem::Requirement
315
315
  none: false
316
316
  requirements:
317
317
  - - ~>
@@ -319,10 +319,10 @@ dependencies:
319
319
  version: 1.3.2
320
320
  type: :development
321
321
  prerelease: false
322
- version_requirements: *80798980
322
+ version_requirements: *70359470
323
323
  - !ruby/object:Gem::Dependency
324
324
  name: forgery
325
- requirement: &80796760 !ruby/object:Gem::Requirement
325
+ requirement: &70357500 !ruby/object:Gem::Requirement
326
326
  none: false
327
327
  requirements:
328
328
  - - ~>
@@ -330,10 +330,10 @@ dependencies:
330
330
  version: 0.4.2
331
331
  type: :development
332
332
  prerelease: false
333
- version_requirements: *80796760
333
+ version_requirements: *70357500
334
334
  - !ruby/object:Gem::Dependency
335
335
  name: ci_reporter
336
- requirement: &80788160 !ruby/object:Gem::Requirement
336
+ requirement: &70344680 !ruby/object:Gem::Requirement
337
337
  none: false
338
338
  requirements:
339
339
  - - ~>
@@ -341,10 +341,10 @@ dependencies:
341
341
  version: 1.6.4
342
342
  type: :development
343
343
  prerelease: false
344
- version_requirements: *80788160
344
+ version_requirements: *70344680
345
345
  - !ruby/object:Gem::Dependency
346
346
  name: nifty-generators
347
- requirement: &80783760 !ruby/object:Gem::Requirement
347
+ requirement: &70339170 !ruby/object:Gem::Requirement
348
348
  none: false
349
349
  requirements:
350
350
  - - ~>
@@ -352,7 +352,7 @@ dependencies:
352
352
  version: 0.4.5
353
353
  type: :development
354
354
  prerelease: false
355
- version_requirements: *80783760
355
+ version_requirements: *70339170
356
356
  description: ! 'Social Stream is a Ruby on Rails engine providing your application
357
357
  with social networking features and activity streams.
358
358
 
@@ -719,6 +719,7 @@ files:
719
719
  - app/views/conversations/_conversations.html.erb
720
720
  - app/views/conversations/_index.html.erb
721
721
  - app/views/conversations/_show.html.erb
722
+ - app/views/conversations/destroy.js.erb
722
723
  - app/views/conversations/edit.html.erb
723
724
  - app/views/conversations/index.html.erb
724
725
  - app/views/conversations/index.js.erb
@@ -908,6 +909,9 @@ files:
908
909
  - lib/social_stream/models/subtype.rb
909
910
  - lib/social_stream/models/supertype.rb
910
911
  - lib/social_stream/populate.rb
912
+ - lib/social_stream/routing/constraints/custom.rb
913
+ - lib/social_stream/routing/constraints/follow.rb
914
+ - lib/social_stream/routing/constraints/resque.rb
911
915
  - lib/social_stream/test_helpers.rb
912
916
  - lib/social_stream/test_helpers/controllers.rb
913
917
  - lib/social_stream/views/list.rb
@@ -919,6 +923,7 @@ files:
919
923
  - social_stream-base.gemspec
920
924
  - spec/controllers/comments_controller_spec.rb
921
925
  - spec/controllers/contacts_controller_spec.rb
926
+ - spec/controllers/followers_controller_spec.rb
922
927
  - spec/controllers/frontpage_controller_spec.rb
923
928
  - spec/controllers/groups_controller_spec.rb
924
929
  - spec/controllers/home_controller_spec.rb
@@ -976,6 +981,7 @@ files:
976
981
  - spec/factories/tie.rb
977
982
  - spec/factories/user.rb
978
983
  - spec/integration/navigation_spec.rb
984
+ - spec/integration/resque_access_spec.rb
979
985
  - spec/models/activity_action_spec.rb
980
986
  - spec/models/activity_authorization_spec.rb
981
987
  - spec/models/activity_spec.rb