commontator 4.11.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/app/controllers/commontator/application_controller.rb +4 -4
- data/app/controllers/commontator/comments_controller.rb +15 -15
- data/app/controllers/commontator/subscriptions_controller.rb +1 -1
- data/app/controllers/commontator/threads_controller.rb +5 -5
- data/app/mailers/commontator/subscriptions_mailer.rb +25 -37
- data/app/models/commontator/comment.rb +11 -11
- data/app/models/commontator/subscription.rb +2 -2
- data/app/models/commontator/thread.rb +9 -9
- data/app/views/commontator/comments/_actions.html.erb +8 -8
- data/app/views/commontator/comments/_body.html.erb +1 -1
- data/app/views/commontator/comments/_form.html.erb +3 -3
- data/app/views/commontator/comments/_list.html.erb +3 -3
- data/app/views/commontator/comments/_show.html.erb +8 -8
- data/app/views/commontator/comments/_votes.html.erb +16 -16
- data/app/views/commontator/comments/cancel.js.erb +5 -5
- data/app/views/commontator/comments/create.js.erb +9 -9
- data/app/views/commontator/comments/delete.js.erb +7 -7
- data/app/views/commontator/comments/edit.js.erb +2 -2
- data/app/views/commontator/comments/new.js.erb +4 -4
- data/app/views/commontator/comments/update.js.erb +1 -1
- data/app/views/commontator/comments/vote.js.erb +3 -3
- data/app/views/commontator/shared/_thread.html.erb +6 -6
- data/app/views/commontator/subscriptions/_link.html.erb +5 -5
- data/app/views/commontator/subscriptions/subscribe.js.erb +3 -3
- data/app/views/commontator/subscriptions_mailer/comment_created.html.erb +6 -6
- data/app/views/commontator/threads/_reply.html.erb +6 -6
- data/app/views/commontator/threads/_show.html.erb +33 -33
- data/app/views/commontator/threads/_show.js.erb +7 -7
- data/app/views/commontator/threads/show.js.erb +6 -6
- data/config/initializers/commontator.rb +43 -38
- data/config/locales/de.yml +100 -0
- data/config/locales/en.yml +26 -27
- data/config/locales/pt-BR.yml +78 -0
- data/config/locales/ru.yml +25 -26
- data/config/locales/zh.yml +26 -27
- data/config/routes.rb +4 -4
- data/db/migrate/0_install_commontator.rb +17 -17
- data/lib/commontator.rb +2 -2
- data/lib/commontator/acts_as_commontable.rb +14 -12
- data/lib/commontator/acts_as_commontator.rb +5 -5
- data/lib/commontator/shared_helper.rb +6 -6
- data/lib/commontator/version.rb +1 -1
- data/lib/tasks/commontator_tasks.rake +2 -2
- data/spec/controllers/commontator/comments_controller_spec.rb +76 -75
- data/spec/controllers/commontator/subscriptions_controller_spec.rb +26 -27
- data/spec/controllers/commontator/threads_controller_spec.rb +42 -41
- data/spec/dummy/app/controllers/dummy_models_controller.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +1 -2
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +1 -2
- data/spec/dummy/config/environments/production.rb +1 -2
- data/spec/dummy/config/environments/test.rb +1 -2
- data/spec/dummy/config/initializers/commontator.rb +7 -7
- data/spec/dummy/config/routes.rb +2 -3
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/1_create_dummy_models.rb +2 -3
- data/spec/dummy/db/migrate/2_create_dummy_users.rb +2 -3
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +4 -10
- data/spec/dummy/db/schema.rb +45 -48
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +413 -0
- data/spec/dummy/log/test.log +33690 -0
- data/spec/lib/commontator/commontable_config_spec.rb +4 -5
- data/spec/lib/commontator/commontator_config_spec.rb +4 -5
- data/spec/lib/commontator_spec.rb +2 -3
- data/spec/mailers/commontator/subscriptions_mailer_spec.rb +2 -3
- data/spec/models/commontator/comment_spec.rb +10 -10
- data/spec/rails_helper.rb +3 -2
- metadata +64 -44
@@ -17,13 +17,12 @@ module Commontator
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'must be configurable' do
|
20
|
-
proc =
|
21
|
-
proc2 =
|
22
|
-
config = CommontableConfig.new(:
|
20
|
+
proc = ->(thread) { 'Some name' }
|
21
|
+
proc2 = ->(thread) { 'Another name' }
|
22
|
+
config = CommontableConfig.new(commontable_name_proc: proc)
|
23
23
|
expect(config.commontable_name_proc).to eq proc
|
24
|
-
config = CommontableConfig.new(:
|
24
|
+
config = CommontableConfig.new(commontable_name_proc: proc2)
|
25
25
|
expect(config.commontable_name_proc).to eq proc2
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
@@ -17,13 +17,12 @@ module Commontator
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'must be configurable' do
|
20
|
-
proc =
|
21
|
-
proc2 =
|
22
|
-
config = CommontatorConfig.new(:
|
20
|
+
proc = ->(user) { 'Some name' }
|
21
|
+
proc2 = ->(user) { 'Another name' }
|
22
|
+
config = CommontatorConfig.new(user_name_proc: proc)
|
23
23
|
expect(config.user_name_proc).to eq proc
|
24
|
-
config = CommontatorConfig.new(:
|
24
|
+
config = CommontatorConfig.new(user_name_proc: proc2)
|
25
25
|
expect(config.user_name_proc).to eq proc2
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
@@ -10,8 +10,8 @@ module Commontator
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'must be configurable' do
|
13
|
-
l1 =
|
14
|
-
l2 =
|
13
|
+
l1 = ->(controller) { controller.current_user }
|
14
|
+
l2 = ->(controller) { controller.current_user }
|
15
15
|
Commontator.configure do |config|
|
16
16
|
config.current_user_proc = l1
|
17
17
|
end
|
@@ -23,4 +23,3 @@ module Commontator
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
@@ -18,7 +18,7 @@ module Commontator
|
|
18
18
|
|
19
19
|
it 'must create deliverable mail' do
|
20
20
|
mail = described_class.comment_created(@comment, @recipients)
|
21
|
-
expect(mail.to).to
|
21
|
+
expect(mail.to).to be_nil
|
22
22
|
expect(mail.cc).to be_nil
|
23
23
|
expect(mail.bcc.size).to eq 1
|
24
24
|
expect(mail.bcc).to include(@user2.email)
|
@@ -38,7 +38,7 @@ module Commontator
|
|
38
38
|
expect(mail.to.size).to eq 1
|
39
39
|
expect(mail.to).to include(@user2.email)
|
40
40
|
expect(mail.cc).to be_nil
|
41
|
-
expect(mail.bcc
|
41
|
+
expect(mail.bcc).to be_nil
|
42
42
|
expect(mail.subject).not_to be_empty
|
43
43
|
expect(mail.body).not_to be_empty
|
44
44
|
expect(mail.deliver_now).to eq mail
|
@@ -47,4 +47,3 @@ module Commontator
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
@@ -50,14 +50,14 @@ module Commontator
|
|
50
50
|
|
51
51
|
expect(@comment.created_timestamp).to eq(
|
52
52
|
I18n.t('commontator.comment.status.created_at',
|
53
|
-
:
|
54
|
-
:
|
53
|
+
created_at: I18n.l(@comment.created_at,
|
54
|
+
format: :commontator))
|
55
55
|
)
|
56
56
|
expect(@comment.updated_timestamp).to eq(
|
57
57
|
I18n.t('commontator.comment.status.updated_at',
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
58
|
+
editor_name: @user.name,
|
59
|
+
updated_at: I18n.l(@comment.updated_at,
|
60
|
+
format: :commontator))
|
61
61
|
)
|
62
62
|
|
63
63
|
user2 = DummyUser.create
|
@@ -67,14 +67,14 @@ module Commontator
|
|
67
67
|
|
68
68
|
expect(@comment.created_timestamp).to eq(
|
69
69
|
I18n.t('commontator.comment.status.created_at',
|
70
|
-
:
|
71
|
-
:
|
70
|
+
created_at: I18n.l(@comment.created_at,
|
71
|
+
format: :commontator))
|
72
72
|
)
|
73
73
|
expect(@comment.updated_timestamp).to eq(
|
74
74
|
I18n.t('commontator.comment.status.updated_at',
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
75
|
+
editor_name: user2.name,
|
76
|
+
updated_at: I18n.l(@comment.updated_at,
|
77
|
+
format: :commontator))
|
78
78
|
)
|
79
79
|
end
|
80
80
|
end
|
data/spec/rails_helper.rb
CHANGED
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
4
4
|
require File.expand_path("../dummy/config/environment", __FILE__)
|
5
5
|
require 'rspec/rails'
|
6
6
|
# Add additional requires below this line. Rails is not loaded until this point!
|
7
|
+
require 'rails-controller-testing'
|
8
|
+
Rails::Controller::Testing.install
|
7
9
|
|
8
10
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
9
11
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
@@ -40,7 +42,7 @@ RSpec.configure do |config|
|
|
40
42
|
# You can disable this behaviour by removing the line below, and instead
|
41
43
|
# explicitly tag your specs with their type, e.g.:
|
42
44
|
#
|
43
|
-
# RSpec.describe UsersController, :
|
45
|
+
# RSpec.describe UsersController, type: :controller do
|
44
46
|
# # ...
|
45
47
|
# end
|
46
48
|
#
|
@@ -68,4 +70,3 @@ end
|
|
68
70
|
def setup_mailer_spec
|
69
71
|
setup_model_spec
|
70
72
|
end
|
71
|
-
|
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
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jquery-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rails-controller-testing
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: acts_as_votable
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +177,9 @@ files:
|
|
163
177
|
- app/views/commontator/threads/_show.js.erb
|
164
178
|
- app/views/commontator/threads/show.js.erb
|
165
179
|
- config/initializers/commontator.rb
|
180
|
+
- config/locales/de.yml
|
166
181
|
- config/locales/en.yml
|
182
|
+
- config/locales/pt-BR.yml
|
167
183
|
- config/locales/ru.yml
|
168
184
|
- config/locales/zh.yml
|
169
185
|
- config/routes.rb
|
@@ -211,12 +227,14 @@ files:
|
|
211
227
|
- spec/dummy/config/initializers/session_store.rb
|
212
228
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
213
229
|
- spec/dummy/config/routes.rb
|
230
|
+
- spec/dummy/db/development.sqlite3
|
214
231
|
- spec/dummy/db/migrate/1_create_dummy_models.rb
|
215
232
|
- spec/dummy/db/migrate/2_create_dummy_users.rb
|
216
233
|
- spec/dummy/db/migrate/3_acts_as_votable_migration.rb
|
217
234
|
- spec/dummy/db/schema.rb
|
218
235
|
- spec/dummy/db/test.sqlite3
|
219
236
|
- spec/dummy/lib/dummy_controllers.rb
|
237
|
+
- spec/dummy/log/development.log
|
220
238
|
- spec/dummy/log/test.log
|
221
239
|
- spec/dummy/public/404.html
|
222
240
|
- spec/dummy/public/422.html
|
@@ -265,60 +283,62 @@ signing_key:
|
|
265
283
|
specification_version: 4
|
266
284
|
summary: Allows users to comment on any model in your application.
|
267
285
|
test_files:
|
268
|
-
- spec/
|
269
|
-
- spec/
|
270
|
-
- spec/
|
271
|
-
- spec/dummy/app/assets/javascripts/application.js
|
272
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
286
|
+
- spec/spec_helper.rb
|
287
|
+
- spec/dummy/app/models/dummy_user.rb
|
288
|
+
- spec/dummy/app/models/dummy_model.rb
|
273
289
|
- spec/dummy/app/controllers/application_controller.rb
|
274
290
|
- spec/dummy/app/controllers/dummy_models_controller.rb
|
275
|
-
- spec/dummy/app/helpers/application_helper.rb
|
276
|
-
- spec/dummy/app/models/dummy_model.rb
|
277
|
-
- spec/dummy/app/models/dummy_user.rb
|
278
291
|
- spec/dummy/app/views/dummy_models/show.html.erb
|
279
292
|
- spec/dummy/app/views/layouts/application.html.erb
|
280
|
-
- spec/dummy/
|
281
|
-
- spec/dummy/
|
282
|
-
- spec/dummy/
|
283
|
-
- spec/dummy/config/
|
284
|
-
- spec/dummy/config/environments/development.rb
|
293
|
+
- spec/dummy/app/assets/javascripts/application.js
|
294
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
295
|
+
- spec/dummy/app/helpers/application_helper.rb
|
296
|
+
- spec/dummy/config/routes.rb
|
285
297
|
- spec/dummy/config/environments/production.rb
|
298
|
+
- spec/dummy/config/environments/development.rb
|
286
299
|
- spec/dummy/config/environments/test.rb
|
300
|
+
- spec/dummy/config/environment.rb
|
301
|
+
- spec/dummy/config/application.rb
|
302
|
+
- spec/dummy/config/database.yml
|
303
|
+
- spec/dummy/config/boot.rb
|
287
304
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
288
|
-
- spec/dummy/config/initializers/commontator.rb
|
289
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
290
|
-
- spec/dummy/config/initializers/inflections.rb
|
291
305
|
- spec/dummy/config/initializers/mime_types.rb
|
292
|
-
- spec/dummy/config/initializers/
|
306
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
293
307
|
- spec/dummy/config/initializers/session_store.rb
|
294
308
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
295
|
-
- spec/dummy/config/
|
309
|
+
- spec/dummy/config/initializers/commontator.rb
|
310
|
+
- spec/dummy/config/initializers/secret_token.rb
|
311
|
+
- spec/dummy/config/initializers/inflections.rb
|
296
312
|
- spec/dummy/config.ru
|
297
|
-
- spec/dummy/
|
298
|
-
- spec/dummy/
|
299
|
-
- spec/dummy/
|
313
|
+
- spec/dummy/script/rails
|
314
|
+
- spec/dummy/README.md
|
315
|
+
- spec/dummy/Rakefile
|
316
|
+
- spec/dummy/public/favicon.ico
|
317
|
+
- spec/dummy/public/422.html
|
318
|
+
- spec/dummy/public/500.html
|
319
|
+
- spec/dummy/public/404.html
|
320
|
+
- spec/dummy/lib/dummy_controllers.rb
|
300
321
|
- spec/dummy/db/schema.rb
|
301
322
|
- spec/dummy/db/test.sqlite3
|
302
|
-
- spec/dummy/
|
323
|
+
- spec/dummy/db/migrate/3_acts_as_votable_migration.rb
|
324
|
+
- spec/dummy/db/migrate/1_create_dummy_models.rb
|
325
|
+
- spec/dummy/db/migrate/2_create_dummy_users.rb
|
326
|
+
- spec/dummy/db/development.sqlite3
|
303
327
|
- spec/dummy/log/test.log
|
304
|
-
- spec/dummy/
|
305
|
-
- spec/dummy/public/422.html
|
306
|
-
- spec/dummy/public/500.html
|
307
|
-
- spec/dummy/public/favicon.ico
|
308
|
-
- spec/dummy/Rakefile
|
309
|
-
- spec/dummy/README.md
|
310
|
-
- spec/dummy/script/rails
|
311
|
-
- spec/helpers/commontator/application_helper_spec.rb
|
312
|
-
- spec/lib/commontator/acts_as_commontable_spec.rb
|
313
|
-
- spec/lib/commontator/acts_as_commontator_spec.rb
|
314
|
-
- spec/lib/commontator/commontable_config_spec.rb
|
315
|
-
- spec/lib/commontator/commontator_config_spec.rb
|
316
|
-
- spec/lib/commontator/controllers_spec.rb
|
317
|
-
- spec/lib/commontator/shared_helper_spec.rb
|
318
|
-
- spec/lib/commontator_spec.rb
|
328
|
+
- spec/dummy/log/development.log
|
319
329
|
- spec/mailers/commontator/subscriptions_mailer_spec.rb
|
320
|
-
- spec/models/commontator/comment_spec.rb
|
321
|
-
- spec/models/commontator/subscription_spec.rb
|
322
330
|
- spec/models/commontator/thread_spec.rb
|
331
|
+
- spec/models/commontator/subscription_spec.rb
|
332
|
+
- spec/models/commontator/comment_spec.rb
|
333
|
+
- spec/lib/commontator_spec.rb
|
334
|
+
- spec/lib/commontator/controllers_spec.rb
|
335
|
+
- spec/lib/commontator/commontator_config_spec.rb
|
336
|
+
- spec/lib/commontator/commontable_config_spec.rb
|
337
|
+
- spec/lib/commontator/acts_as_commontator_spec.rb
|
338
|
+
- spec/lib/commontator/acts_as_commontable_spec.rb
|
339
|
+
- spec/lib/commontator/shared_helper_spec.rb
|
340
|
+
- spec/controllers/commontator/comments_controller_spec.rb
|
341
|
+
- spec/controllers/commontator/subscriptions_controller_spec.rb
|
342
|
+
- spec/controllers/commontator/threads_controller_spec.rb
|
323
343
|
- spec/rails_helper.rb
|
324
|
-
- spec/
|
344
|
+
- spec/helpers/commontator/application_helper_spec.rb
|