commontator 4.0.2 → 4.1.1

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -5
  3. data/app/assets/stylesheets/commontator/comments.css +16 -5
  4. data/app/assets/stylesheets/commontator/comments.css~ +98 -0
  5. data/app/controllers/commontator/application_controller.rb +6 -3
  6. data/app/controllers/commontator/application_controller.rb~ +30 -0
  7. data/app/controllers/commontator/threads_controller.rb +2 -0
  8. data/app/controllers/commontator/threads_controller.rb~ +44 -0
  9. data/app/helpers/commontator/threads_helper.rb +1 -8
  10. data/app/helpers/commontator/threads_helper.rb~ +11 -0
  11. data/app/mailers/commontator/subscriptions_mailer.rb +2 -4
  12. data/app/mailers/commontator/subscriptions_mailer.rb~ +50 -0
  13. data/app/models/commontator/comment.rb +23 -19
  14. data/app/models/commontator/comment.rb~ +106 -0
  15. data/app/models/commontator/thread.rb +10 -10
  16. data/app/models/commontator/thread.rb~ +124 -0
  17. data/app/views/commontator/comments/_show.html.erb +36 -34
  18. data/app/views/commontator/comments/_show.html.erb~ +47 -0
  19. data/app/views/commontator/comments/_votes.html.erb +6 -2
  20. data/app/views/commontator/comments/_votes.html.erb~ +61 -0
  21. data/app/views/commontator/comments/delete.js.erb +2 -2
  22. data/app/views/commontator/comments/delete.js.erb~ +17 -0
  23. data/app/views/commontator/comments/update.js.erb +2 -2
  24. data/app/views/commontator/comments/update.js.erb~ +7 -0
  25. data/app/views/commontator/subscriptions_mailer/comment_created.html.erb +2 -2
  26. data/app/views/commontator/subscriptions_mailer/comment_created.html.erb~ +6 -0
  27. data/app/views/commontator/threads/_show.html.erb +3 -7
  28. data/app/views/commontator/threads/_show.html.erb~ +58 -0
  29. data/config/initializers/commontator.rb +52 -47
  30. data/config/initializers/commontator.rb~ +176 -0
  31. data/lib/commontator.rb +6 -7
  32. data/lib/commontator.rb~ +61 -0
  33. data/lib/commontator/controller_includes.rb +1 -3
  34. data/lib/commontator/controller_includes.rb~ +22 -0
  35. data/lib/commontator/shared_helper.rb +3 -8
  36. data/lib/commontator/shared_helper.rb~ +37 -0
  37. data/lib/commontator/version.rb +1 -1
  38. data/lib/commontator/version.rb~ +3 -0
  39. data/spec/app/controllers/commontator/comments_controller_spec.rb +64 -45
  40. data/spec/app/controllers/commontator/comments_controller_spec.rb~ +580 -0
  41. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +3 -3
  42. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb~ +99 -0
  43. data/spec/app/controllers/commontator/threads_controller_spec.rb +15 -9
  44. data/spec/app/controllers/commontator/threads_controller_spec.rb~ +126 -0
  45. data/spec/app/helpers/commontator/application_helper_spec.rb +1 -1
  46. data/spec/app/helpers/commontator/application_helper_spec.rb~ +9 -0
  47. data/spec/app/helpers/commontator/threads_helper_spec.rb +1 -5
  48. data/spec/app/helpers/commontator/threads_helper_spec.rb~ +13 -0
  49. data/spec/app/models/commontator/comment_spec.rb +4 -3
  50. data/spec/app/models/commontator/comment_spec.rb~ +62 -0
  51. data/spec/dummy/config/application.rb +1 -1
  52. data/spec/dummy/config/application.rb~ +27 -0
  53. data/spec/dummy/config/initializers/commontator.rb +67 -55
  54. data/spec/dummy/config/initializers/commontator.rb~ +176 -0
  55. data/spec/dummy/config/initializers/commontator2.rb~ +169 -0
  56. data/spec/dummy/db/test.sqlite3 +0 -0
  57. data/spec/dummy/log/test.log +84489 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/02d4b791eb831cf2057bf4703a1218d1 +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
  60. data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
  61. data/spec/dummy/tmp/cache/assets/test/sprockets/e1f674c11941d62aac1764ef3a7134e4 +0 -0
  62. data/spec/dummy/tmp/cache/assets/test/sprockets/e85565206c3e5fdf9dfeb367c85557b1 +0 -0
  63. data/spec/lib/commontator/commontable_config_spec.rb +1 -1
  64. data/spec/lib/commontator/commontable_config_spec.rb~ +26 -0
  65. data/spec/lib/commontator/commontator_config_spec.rb +5 -5
  66. data/spec/lib/commontator/commontator_config_spec.rb~ +26 -0
  67. data/spec/lib/commontator_spec.rb +6 -4
  68. data/spec/lib/commontator_spec.rb~ +28 -0
  69. data/spec/test_helper.rb +4 -4
  70. data/spec/test_helper.rb~ +37 -0
  71. metadata +46 -2
@@ -9,7 +9,7 @@ module Commontator
9
9
  end
10
10
  end
11
11
 
12
- it 'wont respond to engine or commontator attributes' do
12
+ it "won't respond to engine or commontator attributes" do
13
13
  config = CommontableConfig.new
14
14
  (ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES).each do |attribute|
15
15
  config.wont_respond_to attribute
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Commontator
4
+ describe CommontableConfig do
5
+ it 'must respond to commontable attributes' do
6
+ config = CommontableConfig.new
7
+ COMMONTABLE_ATTRIBUTES.each do |attribute|
8
+ config.must_respond_to attribute
9
+ end
10
+ end
11
+
12
+ it 'wont respond to engine or commontator attributes' do
13
+ config = CommontableConfig.new
14
+ (ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES).each do |attribute|
15
+ config.wont_respond_to attribute
16
+ end
17
+ end
18
+
19
+ it 'must be configurable' do
20
+ config = CommontableConfig.new(:comment_create_verb_present => 'create')
21
+ config.comment_create_verb_present.must_equal 'create'
22
+ config = CommontableConfig.new(:comment_create_verb_present => 'post')
23
+ config.comment_create_verb_present.must_equal 'post'
24
+ end
25
+ end
26
+ end
@@ -9,7 +9,7 @@ module Commontator
9
9
  end
10
10
  end
11
11
 
12
- it 'wont respond to engine or commontable attributes' do
12
+ it "won't respond to engine or commontable attributes" do
13
13
  config = CommontatorConfig.new
14
14
  (ENGINE_ATTRIBUTES + COMMONTABLE_ATTRIBUTES).each do |attribute|
15
15
  config.wont_respond_to attribute
@@ -17,10 +17,10 @@ module Commontator
17
17
  end
18
18
 
19
19
  it 'must be configurable' do
20
- config = CommontatorConfig.new(:user_missing_name => 'Anon')
21
- config.user_missing_name.must_equal 'Anon'
22
- config = CommontatorConfig.new(:user_missing_name => 'Anonymous')
23
- config.user_missing_name.must_equal 'Anonymous'
20
+ config = CommontatorConfig.new(:user_name_clickable => true)
21
+ config.user_name_clickable.must_equal true
22
+ config = CommontatorConfig.new(:user_name_clickable => false)
23
+ config.user_name_clickable.must_equal false
24
24
  end
25
25
  end
26
26
  end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Commontator
4
+ describe CommontatorConfig do
5
+ it 'must respond to commontator attributes' do
6
+ config = CommontatorConfig.new
7
+ COMMONTATOR_ATTRIBUTES.each do |attribute|
8
+ config.must_respond_to attribute
9
+ end
10
+ end
11
+
12
+ it "won't respond to engine or commontable attributes" do
13
+ config = CommontatorConfig.new
14
+ (ENGINE_ATTRIBUTES + COMMONTABLE_ATTRIBUTES).each do |attribute|
15
+ config.wont_respond_to attribute
16
+ end
17
+ end
18
+
19
+ it 'must be configurable' do
20
+ config = CommontatorConfig.new(:user_name_clickable => true)
21
+ config.user_name_clickable.must_equal be_true
22
+ config = CommontatorConfig.new(:user_name_clickable => false)
23
+ config.user_name_clickable.must be_false
24
+ end
25
+ end
26
+ end
@@ -10,14 +10,16 @@ module Commontator
10
10
  end
11
11
 
12
12
  it 'must be configurable' do
13
+ l1 = lambda { |controller| controller.current_user }
14
+ l2 = lambda { |controller| controller.current_user }
13
15
  Commontator.configure do |config|
14
- config.current_user_method = 'user'
16
+ config.current_user_proc = l1
15
17
  end
16
- Commontator.current_user_method.must_equal 'user'
18
+ assert_equal(Commontator.current_user_proc, l1)
17
19
  Commontator.configure do |config|
18
- config.current_user_method = 'current_user'
20
+ config.current_user_proc = l2
19
21
  end
20
- Commontator.current_user_method.must_equal 'current_user'
22
+ assert_equal(Commontator.current_user_proc, l2)
21
23
  end
22
24
  end
23
25
  end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+ require 'test/unit/assertions'
3
+
4
+ module Commontator
5
+ include Test::Unit::Assertions
6
+ describe Commontator do
7
+ it 'must respond to all attributes' do
8
+ (ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES + \
9
+ COMMONTABLE_ATTRIBUTES).each do |attribute|
10
+ Commontator.must_respond_to attribute
11
+ end
12
+ end
13
+
14
+ it 'must be configurable' do
15
+ l1 = lambda { |controller| controller.current_user }
16
+ l2 = lambda { |controller| controller.current_user }
17
+ assert_not_equal(l1, l2)
18
+ Commontator.configure do |config|
19
+ config.current_user_proc = l1
20
+ end
21
+ assert_equal(Commontator.current_user_proc, l1)
22
+ Commontator.configure do |config|
23
+ config.current_user_proc = l2
24
+ end
25
+ assert_equal(Commontator.current_user_proc, l2)
26
+ end
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path("../dummy/config/environment", __FILE__)
3
- require "rails/test_help"
4
- require "minitest/rails"
1
+ ENV['RAILS_ENV'] = 'test'
2
+ require File.expand_path('../dummy/config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+ require 'minitest/rails'
5
5
 
6
6
  # To add Capybara feature tests add `gem "minitest-rails-capybara"`
7
7
  # to the test group in the Gemfile and uncomment the following:
@@ -0,0 +1,37 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+ require File.expand_path('../dummy/config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+ require 'minitest/rails'
5
+
6
+ # To add Capybara feature tests add `gem "minitest-rails-capybara"`
7
+ # to the test group in the Gemfile and uncomment the following:
8
+ # require "minitest/rails/capybara"
9
+
10
+ # Uncomment for awesome colorful output
11
+ # require "minitest/pride"
12
+
13
+ Rails.backtrace_cleaner.remove_silencers!
14
+
15
+ Commontator::ApplicationController.class_eval do
16
+ include Commontator::ApplicationHelper
17
+ end
18
+
19
+ def setup_model_spec
20
+ @user = DummyUser.create
21
+ @commontable = DummyModel.create
22
+ @thread = @commontable.thread
23
+ end
24
+
25
+ def setup_controller_spec
26
+ class_eval {include Commontator::ApplicationHelper}
27
+ sign_out
28
+ setup_model_spec
29
+ end
30
+
31
+ def setup_helper_spec
32
+ setup_model_spec
33
+ end
34
+
35
+ def setup_mailer_spec
36
+ setup_model_spec
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commontator
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-06 00:00:00.000000000 Z
11
+ date: 2013-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -87,63 +87,87 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - app/controllers/commontator/application_controller.rb~
90
91
  - app/controllers/commontator/threads_controller.rb
92
+ - app/controllers/commontator/threads_controller.rb~
91
93
  - app/controllers/commontator/application_controller.rb
92
94
  - app/controllers/commontator/subscriptions_controller.rb
93
95
  - app/controllers/commontator/comments_controller.rb
94
96
  - app/assets/stylesheets/commontator/application.css
95
97
  - app/assets/stylesheets/commontator/comments.css
96
98
  - app/assets/stylesheets/commontator/threads.css
99
+ - app/assets/stylesheets/commontator/comments.css~
97
100
  - app/assets/images/commontator/downvote.png
98
101
  - app/assets/images/commontator/upvote_hover.png
99
102
  - app/assets/images/commontator/downvote_hover.png
100
103
  - app/assets/images/commontator/upvote.png
104
+ - app/models/commontator/thread.rb~
101
105
  - app/models/commontator/subscription.rb
102
106
  - app/models/commontator/thread.rb
103
107
  - app/models/commontator/comment.rb
108
+ - app/models/commontator/comment.rb~
109
+ - app/helpers/commontator/threads_helper.rb~
104
110
  - app/helpers/commontator/threads_helper.rb
105
111
  - app/helpers/commontator/application_helper.rb
106
112
  - app/views/commontator/subscriptions/subscribe.js.erb
107
113
  - app/views/commontator/subscriptions/_link.html.erb
108
114
  - app/views/commontator/subscriptions_mailer/comment_created.html.erb
115
+ - app/views/commontator/subscriptions_mailer/comment_created.html.erb~
109
116
  - app/views/commontator/threads/_show.html.erb
110
117
  - app/views/commontator/threads/show.js.erb
118
+ - app/views/commontator/threads/_show.html.erb~
111
119
  - app/views/commontator/shared/_thread.html.erb
112
120
  - app/views/commontator/comments/_votes.html.erb
113
121
  - app/views/commontator/comments/create.js.erb
114
122
  - app/views/commontator/comments/_show.html.erb
115
123
  - app/views/commontator/comments/_actions.html.erb
124
+ - app/views/commontator/comments/update.js.erb~
125
+ - app/views/commontator/comments/_show.html.erb~
116
126
  - app/views/commontator/comments/update.js.erb
117
127
  - app/views/commontator/comments/delete.js.erb
118
128
  - app/views/commontator/comments/new.js.erb
119
129
  - app/views/commontator/comments/_body.html.erb
120
130
  - app/views/commontator/comments/edit.js.erb
131
+ - app/views/commontator/comments/_votes.html.erb~
121
132
  - app/views/commontator/comments/vote.js.erb
122
133
  - app/views/commontator/comments/_form.html.erb
134
+ - app/views/commontator/comments/delete.js.erb~
123
135
  - app/mailers/commontator/subscriptions_mailer.rb
136
+ - app/mailers/commontator/subscriptions_mailer.rb~
124
137
  - config/routes.rb
138
+ - config/initializers/commontator.rb~
125
139
  - config/initializers/commontator.rb
126
140
  - db/migrate/0_install_commontator.rb
141
+ - lib/commontator.rb~
142
+ - lib/commontator/version.rb~
127
143
  - lib/commontator/commontable_config.rb
128
144
  - lib/commontator/acts_as_commontator.rb
129
145
  - lib/commontator/commontator_config.rb
130
146
  - lib/commontator/acts_as_commontable.rb
147
+ - lib/commontator/shared_helper.rb~
131
148
  - lib/commontator/controller_includes.rb
132
149
  - lib/commontator/engine.rb
133
150
  - lib/commontator/shared_helper.rb
134
151
  - lib/commontator/version.rb
152
+ - lib/commontator/controller_includes.rb~
135
153
  - lib/commontator/security_transgression.rb
136
154
  - lib/commontator.rb
137
155
  - lib/tasks/commontator_tasks.rake
138
156
  - MIT-LICENSE
139
157
  - Rakefile
140
158
  - README.md
159
+ - spec/app/controllers/commontator/comments_controller_spec.rb~
160
+ - spec/app/controllers/commontator/threads_controller_spec.rb~
141
161
  - spec/app/controllers/commontator/threads_controller_spec.rb
162
+ - spec/app/controllers/commontator/subscriptions_controller_spec.rb~
142
163
  - spec/app/controllers/commontator/comments_controller_spec.rb
143
164
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
144
165
  - spec/app/models/commontator/comment_spec.rb
145
166
  - spec/app/models/commontator/subscription_spec.rb
146
167
  - spec/app/models/commontator/thread_spec.rb
168
+ - spec/app/models/commontator/comment_spec.rb~
169
+ - spec/app/helpers/commontator/application_helper_spec.rb~
170
+ - spec/app/helpers/commontator/threads_helper_spec.rb~
147
171
  - spec/app/helpers/commontator/threads_helper_spec.rb
148
172
  - spec/app/helpers/commontator/application_helper_spec.rb
149
173
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
@@ -175,14 +199,17 @@ files:
175
199
  - spec/dummy/config/initializers/wrap_parameters.rb
176
200
  - spec/dummy/config/initializers/secret_token.rb
177
201
  - spec/dummy/config/initializers/filter_parameter_logging.rb
202
+ - spec/dummy/config/initializers/commontator.rb~
178
203
  - spec/dummy/config/initializers/mime_types.rb
179
204
  - spec/dummy/config/initializers/session_store.rb
180
205
  - spec/dummy/config/initializers/commontator.rb
181
206
  - spec/dummy/config/initializers/backtrace_silencers.rb
182
207
  - spec/dummy/config/initializers/inflections.rb
208
+ - spec/dummy/config/initializers/commontator2.rb~
183
209
  - spec/dummy/config/boot.rb
184
210
  - spec/dummy/config/application.rb
185
211
  - spec/dummy/config/database.yml
212
+ - spec/dummy/config/application.rb~
186
213
  - spec/dummy/README.md
187
214
  - spec/dummy/public/500.html
188
215
  - spec/dummy/public/422.html
@@ -197,7 +224,11 @@ files:
197
224
  - spec/dummy/db/migrate/1_create_dummy_models.rb
198
225
  - spec/dummy/db/migrate/3_acts_as_votable_migration.rb
199
226
  - spec/dummy/db/test.sqlite3
227
+ - spec/test_helper.rb~
200
228
  - spec/lib/commontator_spec.rb
229
+ - spec/lib/commontator_spec.rb~
230
+ - spec/lib/commontator/commontator_config_spec.rb~
231
+ - spec/lib/commontator/commontable_config_spec.rb~
201
232
  - spec/lib/commontator/acts_as_commontator_spec.rb
202
233
  - spec/lib/commontator/controller_includes_spec.rb
203
234
  - spec/lib/commontator/shared_helper_spec.rb
@@ -229,12 +260,18 @@ signing_key:
229
260
  specification_version: 4
230
261
  summary: Allows users to comment on any model in your application.
231
262
  test_files:
263
+ - spec/app/controllers/commontator/comments_controller_spec.rb~
264
+ - spec/app/controllers/commontator/threads_controller_spec.rb~
232
265
  - spec/app/controllers/commontator/threads_controller_spec.rb
266
+ - spec/app/controllers/commontator/subscriptions_controller_spec.rb~
233
267
  - spec/app/controllers/commontator/comments_controller_spec.rb
234
268
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
235
269
  - spec/app/models/commontator/comment_spec.rb
236
270
  - spec/app/models/commontator/subscription_spec.rb
237
271
  - spec/app/models/commontator/thread_spec.rb
272
+ - spec/app/models/commontator/comment_spec.rb~
273
+ - spec/app/helpers/commontator/application_helper_spec.rb~
274
+ - spec/app/helpers/commontator/threads_helper_spec.rb~
238
275
  - spec/app/helpers/commontator/threads_helper_spec.rb
239
276
  - spec/app/helpers/commontator/application_helper_spec.rb
240
277
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
@@ -266,14 +303,17 @@ test_files:
266
303
  - spec/dummy/config/initializers/wrap_parameters.rb
267
304
  - spec/dummy/config/initializers/secret_token.rb
268
305
  - spec/dummy/config/initializers/filter_parameter_logging.rb
306
+ - spec/dummy/config/initializers/commontator.rb~
269
307
  - spec/dummy/config/initializers/mime_types.rb
270
308
  - spec/dummy/config/initializers/session_store.rb
271
309
  - spec/dummy/config/initializers/commontator.rb
272
310
  - spec/dummy/config/initializers/backtrace_silencers.rb
273
311
  - spec/dummy/config/initializers/inflections.rb
312
+ - spec/dummy/config/initializers/commontator2.rb~
274
313
  - spec/dummy/config/boot.rb
275
314
  - spec/dummy/config/application.rb
276
315
  - spec/dummy/config/database.yml
316
+ - spec/dummy/config/application.rb~
277
317
  - spec/dummy/README.md
278
318
  - spec/dummy/public/500.html
279
319
  - spec/dummy/public/422.html
@@ -288,7 +328,11 @@ test_files:
288
328
  - spec/dummy/db/migrate/1_create_dummy_models.rb
289
329
  - spec/dummy/db/migrate/3_acts_as_votable_migration.rb
290
330
  - spec/dummy/db/test.sqlite3
331
+ - spec/test_helper.rb~
291
332
  - spec/lib/commontator_spec.rb
333
+ - spec/lib/commontator_spec.rb~
334
+ - spec/lib/commontator/commontator_config_spec.rb~
335
+ - spec/lib/commontator/commontable_config_spec.rb~
292
336
  - spec/lib/commontator/acts_as_commontator_spec.rb
293
337
  - spec/lib/commontator/controller_includes_spec.rb
294
338
  - spec/lib/commontator/shared_helper_spec.rb