muck-friends 0.1.9 → 0.1.10

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.
Files changed (62) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/app/controllers/muck/friends_controller.rb +40 -1
  4. data/app/helpers/muck_friends_helper.rb +17 -2
  5. data/app/views/friend_mailer/follow.text.html.erb +3 -3
  6. data/app/views/friend_mailer/follow.text.plain.erb +3 -3
  7. data/app/views/friend_mailer/friend_request.text.html.erb +3 -3
  8. data/app/views/friend_mailer/friend_request.text.plain.erb +3 -3
  9. data/lib/active_record/acts/muck_friend.rb +28 -1
  10. data/lib/active_record/acts/muck_friend_user.rb +8 -0
  11. data/locales/ar.yml +29 -24
  12. data/locales/bg.yml +27 -22
  13. data/locales/ca.yml +30 -25
  14. data/locales/cs.yml +36 -31
  15. data/locales/da.yml +25 -20
  16. data/locales/de.yml +28 -23
  17. data/locales/el.yml +31 -26
  18. data/locales/en.yml +5 -0
  19. data/locales/es.yml +31 -26
  20. data/locales/et.yml +33 -28
  21. data/locales/fa.yml +27 -22
  22. data/locales/fi.yml +31 -26
  23. data/locales/fr.yml +26 -21
  24. data/locales/gl.yml +36 -31
  25. data/locales/hi.yml +30 -25
  26. data/locales/hr.yml +33 -28
  27. data/locales/hu.yml +32 -27
  28. data/locales/id.yml +34 -29
  29. data/locales/it.yml +32 -27
  30. data/locales/iw.yml +29 -24
  31. data/locales/ja.yml +33 -28
  32. data/locales/ko.yml +29 -24
  33. data/locales/lt.yml +28 -23
  34. data/locales/lv.yml +32 -27
  35. data/locales/mt.yml +27 -22
  36. data/locales/nl.yml +28 -23
  37. data/locales/no.yml +29 -24
  38. data/locales/pl.yml +35 -30
  39. data/locales/pt-PT.yml +31 -26
  40. data/locales/ro.yml +32 -27
  41. data/locales/ru.yml +29 -24
  42. data/locales/sk.yml +36 -31
  43. data/locales/sl.yml +34 -29
  44. data/locales/sq.yml +30 -25
  45. data/locales/sr.yml +34 -29
  46. data/locales/sv.yml +33 -28
  47. data/locales/th.yml +35 -30
  48. data/locales/tl.yml +32 -27
  49. data/locales/tr.yml +29 -24
  50. data/locales/uk.yml +30 -25
  51. data/locales/vi.yml +29 -24
  52. data/locales/zh-CN.yml +27 -22
  53. data/locales/zh-TW.yml +26 -21
  54. data/locales/zh.yml +27 -22
  55. data/muck-friends.gemspec +5 -6
  56. data/test/rails_root/app/views/default/block_user_link.html.erb +1 -0
  57. data/test/rails_root/test/functional/default_controller_test.rb +43 -0
  58. data/test/rails_root/test/functional/friends_controller_test.rb +34 -1
  59. data/test/rails_root/test/unit/friend_test.rb +7 -0
  60. data/test/rails_root/test/unit/user_test.rb +14 -4
  61. metadata +7 -5
  62. data/locales/pt.yml +0 -6
data/muck-friends.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-friends}
8
- s.version = "0.1.9"
8
+ s.version = "0.1.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball"]
12
- s.date = %q{2009-08-13}
12
+ s.date = %q{2009-09-10}
13
13
  s.description = %q{Friend engine for the muck system.}
14
14
  s.email = %q{justinball@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -74,7 +74,6 @@ Gem::Specification.new do |s|
74
74
  "locales/no.yml",
75
75
  "locales/pl.yml",
76
76
  "locales/pt-PT.yml",
77
- "locales/pt.yml",
78
77
  "locales/ro.yml",
79
78
  "locales/ru.yml",
80
79
  "locales/sk.yml",
@@ -107,6 +106,7 @@ Gem::Specification.new do |s|
107
106
  "test/rails_root/app/models/user.rb",
108
107
  "test/rails_root/app/models/user_session.rb",
109
108
  "test/rails_root/app/views/default/all_friends.html.erb",
109
+ "test/rails_root/app/views/default/block_user_link.html.erb",
110
110
  "test/rails_root/app/views/default/followers.html.erb",
111
111
  "test/rails_root/app/views/default/followings.html.erb",
112
112
  "test/rails_root/app/views/default/friend_link.html.erb",
@@ -347,12 +347,11 @@ Gem::Specification.new do |s|
347
347
  "test/rails_root/vendor/plugins/validation_reflection/test/validation_reflection_test.rb",
348
348
  "uninstall.rb"
349
349
  ]
350
- s.has_rdoc = true
351
350
  s.homepage = %q{http://github.com/jbasdf/muck_friends}
352
351
  s.rdoc_options = ["--charset=UTF-8"]
353
352
  s.require_paths = ["lib"]
354
353
  s.rubyforge_project = %q{muck-friends}
355
- s.rubygems_version = %q{1.3.1}
354
+ s.rubygems_version = %q{1.3.5}
356
355
  s.summary = %q{Friends engine for the muck system}
357
356
  s.test_files = [
358
357
  "test/rails_root/app/controllers/application_controller.rb",
@@ -410,7 +409,7 @@ Gem::Specification.new do |s|
410
409
 
411
410
  if s.respond_to? :specification_version then
412
411
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
413
- s.specification_version = 2
412
+ s.specification_version = 3
414
413
 
415
414
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
416
415
  s.add_runtime_dependency(%q<muck-engine>, [">= 0"])
@@ -0,0 +1 @@
1
+ <%= block_user_link(current_user, @user) %>
@@ -44,6 +44,49 @@ class Muck::DefaultControllerTest < ActionController::TestCase
44
44
  @controller.stubs(:other_user).returns(@quentin)
45
45
  end
46
46
 
47
+ context "block user link" do
48
+ context "users have no relationship" do
49
+ setup do
50
+ @controller.stubs(:current_user).returns(@aaron)
51
+ get :block_user_link
52
+ end
53
+ should_respond_with :success
54
+ should_render_template :block_user_link
55
+ should "not have block link in the body" do
56
+ assert !@response.body.include?(I18n.t('muck.friends.block', :user => @quentin.display_name))
57
+ assert !@response.body.include?(I18n.t('muck.friends.unblock', :user => @quentin.display_name))
58
+ end
59
+ end
60
+ context "logged in as aaron" do
61
+ context "quentin following aaron" do
62
+ setup do
63
+ assert @quentin.follow(@aaron)
64
+ @controller.stubs(:current_user).returns(@aaron)
65
+ get :block_user_link
66
+ end
67
+ should_respond_with :success
68
+ should_render_template :block_user_link
69
+ should "have 'block' in the body" do
70
+ assert @response.body.include?(I18n.t('muck.friends.block', :user => @quentin.display_name))
71
+ end
72
+ end
73
+ context "aaron has blocked quentin" do
74
+ setup do
75
+ assert @quentin.follow(@aaron)
76
+ assert @aaron.block_user(@quentin)
77
+ assert @aaron.blocked?(@quentin)
78
+ @controller.stubs(:current_user).returns(@aaron)
79
+ get :block_user_link
80
+ end
81
+ should_respond_with :success
82
+ should_render_template :block_user_link
83
+ should "have 'unblock' in the body" do
84
+ assert @response.body.include?(I18n.t('muck.friends.unblock', :user => @quentin.display_name))
85
+ end
86
+ end
87
+ end
88
+ end
89
+
47
90
  context "friend link" do
48
91
  setup do
49
92
  @enable_following = GlobalConfig.enable_following
@@ -77,7 +77,7 @@ class Muck::FriendsControllerTest < ActionController::TestCase
77
77
  context "make a friendship" do
78
78
  setup do
79
79
  Friend.destroy_all
80
- Friend.make_friends @quentin, @aaron
80
+ Friend.add_follower(@quentin, @aaron)
81
81
  post :create, { :id => @aaron.to_param, :format=>'js'}
82
82
  end
83
83
  should_respond_with :success
@@ -92,6 +92,39 @@ class Muck::FriendsControllerTest < ActionController::TestCase
92
92
  end
93
93
  end
94
94
 
95
+ context "update - block user" do
96
+ setup do
97
+ Friend.destroy_all
98
+ Friend.add_follower(@quentin, @aaron)
99
+ Friend.make_friends(@quentin, @aaron)
100
+ post :update, { :id => @aaron.to_param, :block => true, :format=>'js'}
101
+ end
102
+ should_respond_with :success
103
+ should_not_set_the_flash
104
+ should "block user" do
105
+ @quentin.reload
106
+ @aaron.reload
107
+ assert @quentin.blocked?(@aaron)
108
+ end
109
+ end
110
+
111
+ context "update - unblock user" do
112
+ setup do
113
+ Friend.destroy_all
114
+ Friend.add_follower(@quentin, @aaron)
115
+ Friend.make_friends(@quentin, @aaron)
116
+ @quentin.block_user(@aaron)
117
+ post :update, { :id => @aaron.to_param, :block => false, :format=>'js'}
118
+ end
119
+ should_respond_with :success
120
+ should_not_set_the_flash
121
+ should "unblock user" do
122
+ @quentin.reload
123
+ @aaron.reload
124
+ assert !@quentin.blocked?(@aaron)
125
+ end
126
+ end
127
+
95
128
  context "error while trying to make an invalid friendship" do
96
129
  setup do
97
130
  Friend.destroy_all
@@ -149,6 +149,13 @@ class FriendTest < ActiveSupport::TestCase
149
149
  assert !@aaron.following?(@quentin)
150
150
  assert !@aaron.followed_by?(@quentin)
151
151
  end
152
+
153
+ should "show if user is blocked" do
154
+ assert Friend.add_follower(@quentin, @aaron)
155
+ Friend.block_user(@aaron, @quentin)
156
+ assert Friend.blocked?(@aaron, @quentin)
157
+ end
158
+
152
159
  end
153
160
 
154
161
  should "ignore block user request" do
@@ -87,6 +87,7 @@ class UserTest < ActiveSupport::TestCase
87
87
  assert @aaron.following?(@quentin)
88
88
  assert !@aaron.followed_by?(@quentin)
89
89
  end
90
+
90
91
  context "drop_friend" do
91
92
  setup do
92
93
  assert @quentin.follow(@aaron)
@@ -102,10 +103,6 @@ class UserTest < ActiveSupport::TestCase
102
103
  assert !@quentin.followings.any?{|f| f.id == @aaron.id}
103
104
  end
104
105
  end
105
- should "become friends" do
106
- assert @aaron.follow(@quentin)
107
- assert @quentin.become_friends_with(@aaron)
108
- end
109
106
 
110
107
  should "have friends" do
111
108
  assert @aaron.follow(@quentin)
@@ -176,6 +173,7 @@ class UserTest < ActiveSupport::TestCase
176
173
  assert @aaron.friends.any?{|f| f.id == @quentin.id}
177
174
  assert @quentin.friends.any?{|f| f.id == @aaron.id}
178
175
  end
176
+
179
177
  should "not have a network" do
180
178
  assert !@quentin.has_network?
181
179
  end
@@ -191,6 +189,7 @@ class UserTest < ActiveSupport::TestCase
191
189
  assert !@aaron.friends.any?{|f| f.id == @quentin.id}
192
190
  assert !@aaron.followers.any?{|f| f.id == @quentin.id}
193
191
  assert !@quentin.followings.any?{|f| f.id == @aaron.id}
192
+ assert @aaron.blocked?(@quentin)
194
193
  end
195
194
 
196
195
  should "unblock user" do
@@ -199,7 +198,18 @@ class UserTest < ActiveSupport::TestCase
199
198
  assert @aaron.unblock_user(@quentin)
200
199
  assert @aaron.followers.any?{|f| f.id == @quentin.id}
201
200
  assert @quentin.followings.any?{|f| f.id == @aaron.id}
201
+ assert !@aaron.blocked?(@quentin)
202
+ end
203
+
204
+ should "have friend relation" do
205
+ assert @quentin.follow(@aaron)
206
+ assert @aaron.friendship_with(@quentin)
207
+ end
208
+
209
+ should "not have friend relation" do
210
+ assert !@quentin.friendship_with(@aaron)
202
211
  end
212
+
203
213
  end
204
214
 
205
215
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-friends
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-13 00:00:00 -06:00
12
+ date: 2009-09-10 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -109,7 +109,6 @@ files:
109
109
  - locales/no.yml
110
110
  - locales/pl.yml
111
111
  - locales/pt-PT.yml
112
- - locales/pt.yml
113
112
  - locales/ro.yml
114
113
  - locales/ru.yml
115
114
  - locales/sk.yml
@@ -142,6 +141,7 @@ files:
142
141
  - test/rails_root/app/models/user.rb
143
142
  - test/rails_root/app/models/user_session.rb
144
143
  - test/rails_root/app/views/default/all_friends.html.erb
144
+ - test/rails_root/app/views/default/block_user_link.html.erb
145
145
  - test/rails_root/app/views/default/followers.html.erb
146
146
  - test/rails_root/app/views/default/followings.html.erb
147
147
  - test/rails_root/app/views/default/friend_link.html.erb
@@ -383,6 +383,8 @@ files:
383
383
  - uninstall.rb
384
384
  has_rdoc: true
385
385
  homepage: http://github.com/jbasdf/muck_friends
386
+ licenses: []
387
+
386
388
  post_install_message:
387
389
  rdoc_options:
388
390
  - --charset=UTF-8
@@ -403,9 +405,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
403
405
  requirements: []
404
406
 
405
407
  rubyforge_project: muck-friends
406
- rubygems_version: 1.3.1
408
+ rubygems_version: 1.3.5
407
409
  signing_key:
408
- specification_version: 2
410
+ specification_version: 3
409
411
  summary: Friends engine for the muck system
410
412
  test_files:
411
413
  - test/rails_root/app/controllers/application_controller.rb
data/locales/pt.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- pt:
3
- muck:
4
- friends:
5
- friends_title: "Meus amigos"
6
- same_inviter_error_message: "O usuário não pode tornar-se amigos com themself."