commontator 2.0.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +20 -2
  4. data/app/controllers/commontator/comments_controller.rb +19 -11
  5. data/app/controllers/commontator/subscriptions_controller.rb +5 -5
  6. data/app/controllers/commontator/threads_controller.rb +3 -3
  7. data/app/mailers/commontator/subscriptions_mailer.rb +3 -2
  8. data/app/models/commontator/comment.rb +0 -6
  9. data/app/models/commontator/subscription.rb +0 -4
  10. data/app/models/commontator/thread.rb +4 -7
  11. data/app/views/commontator/comments/_actions.html.erb +1 -1
  12. data/app/views/commontator/comments/_votes.html.erb +4 -4
  13. data/app/views/commontator/shared/_thread.html.erb +1 -1
  14. data/app/views/commontator/subscriptions/_link.html.erb +1 -1
  15. data/app/views/commontator/threads/_show.html.erb +1 -1
  16. data/config/initializers/commontator.rb +1 -1
  17. data/config/routes.rb +15 -15
  18. data/db/migrate/0_install.rb +50 -0
  19. data/db/migrate/0_install.rb~ +3 -3
  20. data/lib/commontator/shared_helper.rb +1 -1
  21. data/lib/commontator/version.rb +1 -1
  22. data/lib/commontator/version.rb~ +1 -1
  23. data/spec/app/controllers/commontator/comments_controller_spec.rb +90 -41
  24. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +16 -16
  25. data/spec/app/controllers/commontator/threads_controller_spec.rb +13 -13
  26. data/spec/app/helpers/commontator/application_helper_spec.rb +1 -1
  27. data/spec/app/helpers/commontator/threads_helper_spec.rb +1 -1
  28. data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +2 -2
  29. data/spec/app/models/commontator/comment_spec.rb +1 -1
  30. data/spec/app/models/commontator/subscription_spec.rb +1 -1
  31. data/spec/app/models/commontator/thread_spec.rb +1 -1
  32. data/spec/dummy/Rakefile +0 -1
  33. data/spec/dummy/config.ru +1 -1
  34. data/spec/dummy/config/application.rb +4 -36
  35. data/spec/dummy/config/boot.rb +4 -9
  36. data/spec/dummy/config/environment.rb +2 -2
  37. data/spec/dummy/config/environments/development.rb +11 -19
  38. data/spec/dummy/config/environments/production.rb +40 -27
  39. data/spec/dummy/config/environments/test.rb +13 -14
  40. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/spec/dummy/config/initializers/inflections.rb +6 -5
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -2
  43. data/spec/dummy/config/initializers/session_store.rb +0 -5
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  45. data/spec/dummy/config/locales/en.yml +20 -2
  46. data/spec/dummy/db/schema.rb +41 -41
  47. data/spec/dummy/db/test.sqlite3 +0 -0
  48. data/spec/dummy/log/test.log +0 -8352
  49. data/spec/lib/commontator/acts_as_commontable_spec.rb +1 -1
  50. data/spec/lib/commontator/acts_as_commontable_spec.rb~ +2 -2
  51. data/spec/lib/commontator/acts_as_commontator_spec.rb +1 -1
  52. data/spec/lib/commontator/commontable_config_spec.rb +1 -1
  53. data/spec/lib/commontator/commontator_config_spec.rb +1 -1
  54. data/spec/lib/commontator/controller_includes_spec.rb +3 -3
  55. data/spec/lib/commontator/shared_helper_spec.rb +7 -3
  56. data/spec/lib/commontator_spec.rb +1 -1
  57. data/spec/{minitest_helper.rb → test_helper.rb} +8 -4
  58. metadata +9 -10
  59. data/app/models/commontator/comment_observer.rb +0 -12
  60. data/db/migrate/0_install_commontator.rb +0 -50
  61. data/spec/app/models/commontator/comment_observer_spec.rb +0 -27
@@ -1,4 +1,4 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe ActsAsCommontable do
@@ -1,9 +1,9 @@
1
- require 'test_helper'
1
+ require 'minitest_helper'
2
2
 
3
3
  module Commontator
4
4
  describe ActsAsCommontable do
5
5
  it 'must add methods to ActiveRecord and subclasses' do
6
- ActiveRecord::Base.must_respond_to :acts_as_common
6
+ ActiveRecord::Base.must_respond_to :acts_as_commontable
7
7
  ActiveRecord::Base.must_respond_to :is_commontable
8
8
  ActiveRecord::Base.is_commontable.must_equal false
9
9
  DummyModel.must_respond_to :acts_as_commontable
@@ -1,4 +1,4 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe ActsAsCommontator do
@@ -1,4 +1,4 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe CommontableConfig do
@@ -1,4 +1,4 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe CommontatorConfig do
@@ -1,10 +1,10 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe ControllerIncludes do
5
5
  it 'must add commontator_thread_show to ActionController instances' do
6
- ActionController::Base.new.must_respond_to :commontator_thread_show
7
- DummyModelsController.new.must_respond_to :commontator_thread_show
6
+ ActionController::Base.new.respond_to?(:commontator_thread_show, true).must_equal true
7
+ DummyModelsController.new.respond_to?(:commontator_thread_show, true).must_equal true
8
8
  end
9
9
 
10
10
  it 'must add shared helper to ActionController and subclasses' do
@@ -1,10 +1,14 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe SharedHelper do
5
5
  it 'must show commontator thread' do
6
- view_context = DummyModelsController.new.view_context
7
- thread_link = view_context.commontator_thread(DummyModel.create)
6
+ controller = DummyModelsController.new
7
+ # Workaround for https://github.com/rails/rails/issues/11662
8
+ controller.define_singleton_method(:params) do
9
+ {}
10
+ end
11
+ thread_link = controller.view_context.commontator_thread(DummyModel.create)
8
12
  thread_link.wont_be_nil
9
13
  thread_link.wont_be_empty
10
14
  end
@@ -1,4 +1,4 @@
1
- require 'minitest_helper'
1
+ require 'test_helper'
2
2
 
3
3
  module Commontator
4
4
  describe Commontator do
@@ -1,10 +1,14 @@
1
- # Configure Rails Environment
2
1
  ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path("../dummy/config/environment", __FILE__)
3
+ require "rails/test_help"
4
+ require "minitest/rails"
3
5
 
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
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"
5
9
 
6
- require "minitest/autorun"
7
- require "minitest/rails"
10
+ # Uncomment for awesome colorful output
11
+ # require "minitest/pride"
8
12
 
9
13
  Rails.backtrace_cleaner.remove_silencers!
10
14
 
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: 2.0.2
4
+ version: 4.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: 2013-11-04 00:00:00.000000000 Z
11
+ date: 2013-09-25 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: '3.1'
19
+ version: '4.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: '3.1'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,6 @@ files:
108
108
  - app/models/commontator/subscription.rb~
109
109
  - app/models/commontator/thread.rb
110
110
  - app/models/commontator/comment.rb
111
- - app/models/commontator/comment_observer.rb
112
111
  - app/models/commontator/comment.rb~
113
112
  - app/helpers/commontator/threads_helper.rb
114
113
  - app/helpers/commontator/application_helper.rb
@@ -144,7 +143,7 @@ files:
144
143
  - config/initializers/commontator.rb~
145
144
  - config/initializers/commontator.rb
146
145
  - config/routes.rb~
147
- - db/migrate/0_install_commontator.rb
146
+ - db/migrate/0_install.rb
148
147
  - db/migrate/0_install.rb~
149
148
  - lib/commontator.rb~
150
149
  - lib/commontator/version.rb~
@@ -168,7 +167,6 @@ files:
168
167
  - MIT-LICENSE
169
168
  - Rakefile
170
169
  - README.md
171
- - spec/minitest_helper.rb
172
170
  - spec/app/controllers/commontator/comments_controller_spec.rb~
173
171
  - spec/app/controllers/commontator/threads_controller_spec.rb~
174
172
  - spec/app/controllers/commontator/threads_controller_spec.rb
@@ -176,7 +174,6 @@ files:
176
174
  - spec/app/controllers/commontator/comments_controller_spec.rb
177
175
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
178
176
  - spec/app/models/commontator/comment_observer_spec.rb~
179
- - spec/app/models/commontator/comment_observer_spec.rb
180
177
  - spec/app/models/commontator/thread_spec.rb~
181
178
  - spec/app/models/commontator/comment_spec.rb
182
179
  - spec/app/models/commontator/subscription_spec.rb
@@ -189,6 +186,7 @@ files:
189
186
  - spec/app/helpers/commontator/application_helper_spec.rb
190
187
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
191
188
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
189
+ - spec/test_helper.rb
192
190
  - spec/minitest_helper.rb~
193
191
  - spec/dummy/script/rails
194
192
  - spec/dummy/Rakefile
@@ -222,6 +220,7 @@ files:
222
220
  - spec/dummy/config/initializers/secret_token.rb~
223
221
  - spec/dummy/config/initializers/wrap_parameters.rb
224
222
  - spec/dummy/config/initializers/secret_token.rb
223
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
225
224
  - spec/dummy/config/initializers/mime_types.rb
226
225
  - spec/dummy/config/initializers/session_store.rb
227
226
  - spec/dummy/config/initializers/commontator.rb
@@ -288,7 +287,6 @@ signing_key:
288
287
  specification_version: 4
289
288
  summary: Allows users to comment on any model in your application.
290
289
  test_files:
291
- - spec/minitest_helper.rb
292
290
  - spec/app/controllers/commontator/comments_controller_spec.rb~
293
291
  - spec/app/controllers/commontator/threads_controller_spec.rb~
294
292
  - spec/app/controllers/commontator/threads_controller_spec.rb
@@ -296,7 +294,6 @@ test_files:
296
294
  - spec/app/controllers/commontator/comments_controller_spec.rb
297
295
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
298
296
  - spec/app/models/commontator/comment_observer_spec.rb~
299
- - spec/app/models/commontator/comment_observer_spec.rb
300
297
  - spec/app/models/commontator/thread_spec.rb~
301
298
  - spec/app/models/commontator/comment_spec.rb
302
299
  - spec/app/models/commontator/subscription_spec.rb
@@ -309,6 +306,7 @@ test_files:
309
306
  - spec/app/helpers/commontator/application_helper_spec.rb
310
307
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
311
308
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
309
+ - spec/test_helper.rb
312
310
  - spec/minitest_helper.rb~
313
311
  - spec/dummy/script/rails
314
312
  - spec/dummy/Rakefile
@@ -342,6 +340,7 @@ test_files:
342
340
  - spec/dummy/config/initializers/secret_token.rb~
343
341
  - spec/dummy/config/initializers/wrap_parameters.rb
344
342
  - spec/dummy/config/initializers/secret_token.rb
343
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
345
344
  - spec/dummy/config/initializers/mime_types.rb
346
345
  - spec/dummy/config/initializers/session_store.rb
347
346
  - spec/dummy/config/initializers/commontator.rb
@@ -1,12 +0,0 @@
1
- module Commontator
2
- class CommentObserver < ActiveRecord::Observer
3
- def after_create(comment)
4
- thread = comment.thread
5
- thread.subscribe(comment.creator) if thread.config.auto_subscribe_on_comment
6
- thread.add_unread_except_for(comment.creator)
7
- recipients = thread.active_subscribers.reject{|s| s == comment.creator}
8
- SubscriptionsMailer.comment_created(comment, recipients).deliver \
9
- unless recipients.empty?
10
- end
11
- end
12
- end
@@ -1,50 +0,0 @@
1
- class InstallCommontator < ActiveRecord::Migration
2
- def change
3
- create_table "commontator_comments" do |t|
4
- t.string "creator_type"
5
- t.integer "creator_id"
6
- t.string "editor_type"
7
- t.integer "editor_id"
8
- t.integer "thread_id", :null => false
9
- t.text "body", :null => false
10
- t.datetime "deleted_at"
11
-
12
- t.integer "cached_votes_total", :default => 0
13
- t.integer "cached_votes_up", :default => 0
14
- t.integer "cached_votes_down", :default => 0
15
-
16
- t.timestamps
17
- end
18
-
19
- add_index :commontator_comments, [:creator_type, :creator_id, :thread_id], :name => "index_c_c_on_c_type_and_c_id_and_t_id"
20
- add_index :commontator_comments, :thread_id
21
-
22
- add_index :commontator_comments, :cached_votes_total
23
- add_index :commontator_comments, :cached_votes_up
24
- add_index :commontator_comments, :cached_votes_down
25
-
26
- create_table "commontator_subscriptions" do |t|
27
- t.string "subscriber_type", :null => false
28
- t.integer "subscriber_id", :null => false
29
- t.integer "thread_id", :null => false
30
- t.integer "unread", :null => false, :default => 0
31
-
32
- t.timestamps
33
- end
34
-
35
- add_index :commontator_subscriptions, [:subscriber_type, :subscriber_id, :thread_id], :unique => true, :name => "index_c_s_on_s_type_and_s_id_and_t_id"
36
- add_index :commontator_subscriptions, :thread_id
37
-
38
- create_table "commontator_threads" do |t|
39
- t.string "commontable_type"
40
- t.integer "commontable_id"
41
- t.datetime "closed_at"
42
- t.string "closer_type"
43
- t.integer "closer_id"
44
-
45
- t.timestamps
46
- end
47
-
48
- add_index :commontator_threads, [:commontable_type, :commontable_id], :unique => true
49
- end
50
- end
@@ -1,27 +0,0 @@
1
- require 'minitest_helper'
2
-
3
- module Commontator
4
- describe CommentObserver do
5
- before do
6
- setup_model_spec
7
- @comment_observer = CommentObserver.instance
8
- @thread.subscribe(@user)
9
- @comment = Comment.new
10
- @comment.thread = @thread
11
- @comment.creator = @user
12
- @comment.body = 'Something'
13
- @comment.save!
14
- end
15
-
16
- it 'wont send mail unless recipients not empty' do
17
- @comment_observer.after_create(@comment).must_be_nil
18
- end
19
-
20
- it 'must send mail if recipients not empty' do
21
- @user2 = DummyUser.create
22
- @thread.subscribe(@user2)
23
- @comment.reload
24
- @comment_observer.after_create(@comment).must_be_instance_of Mail::Message
25
- end
26
- end
27
- end