commontator 2.0.2 → 4.0.0
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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +20 -2
- data/app/controllers/commontator/comments_controller.rb +19 -11
- data/app/controllers/commontator/subscriptions_controller.rb +5 -5
- data/app/controllers/commontator/threads_controller.rb +3 -3
- data/app/mailers/commontator/subscriptions_mailer.rb +3 -2
- data/app/models/commontator/comment.rb +0 -6
- data/app/models/commontator/subscription.rb +0 -4
- data/app/models/commontator/thread.rb +4 -7
- data/app/views/commontator/comments/_actions.html.erb +1 -1
- data/app/views/commontator/comments/_votes.html.erb +4 -4
- data/app/views/commontator/shared/_thread.html.erb +1 -1
- data/app/views/commontator/subscriptions/_link.html.erb +1 -1
- data/app/views/commontator/threads/_show.html.erb +1 -1
- data/config/initializers/commontator.rb +1 -1
- data/config/routes.rb +15 -15
- data/db/migrate/0_install.rb +50 -0
- data/db/migrate/0_install.rb~ +3 -3
- data/lib/commontator/shared_helper.rb +1 -1
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +1 -1
- data/spec/app/controllers/commontator/comments_controller_spec.rb +90 -41
- data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +16 -16
- data/spec/app/controllers/commontator/threads_controller_spec.rb +13 -13
- data/spec/app/helpers/commontator/application_helper_spec.rb +1 -1
- data/spec/app/helpers/commontator/threads_helper_spec.rb +1 -1
- data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +2 -2
- data/spec/app/models/commontator/comment_spec.rb +1 -1
- data/spec/app/models/commontator/subscription_spec.rb +1 -1
- data/spec/app/models/commontator/thread_spec.rb +1 -1
- data/spec/dummy/Rakefile +0 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +4 -36
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +11 -19
- data/spec/dummy/config/environments/production.rb +40 -27
- data/spec/dummy/config/environments/test.rb +13 -14
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -2
- data/spec/dummy/config/initializers/session_store.rb +0 -5
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/db/schema.rb +41 -41
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -8352
- data/spec/lib/commontator/acts_as_commontable_spec.rb +1 -1
- data/spec/lib/commontator/acts_as_commontable_spec.rb~ +2 -2
- data/spec/lib/commontator/acts_as_commontator_spec.rb +1 -1
- data/spec/lib/commontator/commontable_config_spec.rb +1 -1
- data/spec/lib/commontator/commontator_config_spec.rb +1 -1
- data/spec/lib/commontator/controller_includes_spec.rb +3 -3
- data/spec/lib/commontator/shared_helper_spec.rb +7 -3
- data/spec/lib/commontator_spec.rb +1 -1
- data/spec/{minitest_helper.rb → test_helper.rb} +8 -4
- metadata +9 -10
- data/app/models/commontator/comment_observer.rb +0 -12
- data/db/migrate/0_install_commontator.rb +0 -50
- data/spec/app/models/commontator/comment_observer_spec.rb +0 -27
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
module Commontator
|
4
4
|
describe ThreadsController do
|
@@ -35,23 +35,23 @@ module Commontator
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'wont close unless authorized and open' do
|
38
|
-
|
38
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
39
39
|
assert_response 403
|
40
40
|
assigns(:thread).is_closed?.must_equal false
|
41
41
|
|
42
42
|
sign_in @user
|
43
|
-
|
43
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
44
44
|
assert_response 403
|
45
45
|
assigns(:thread).is_closed?.must_equal false
|
46
46
|
|
47
47
|
@user.can_read = true
|
48
|
-
|
48
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
49
49
|
assert_response 403
|
50
50
|
assigns(:thread).is_closed?.must_equal false
|
51
51
|
|
52
52
|
@user.can_edit = true
|
53
53
|
@thread.close.must_equal true
|
54
|
-
|
54
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
55
55
|
assert_redirected_to @thread
|
56
56
|
assigns(:thread).errors.wont_be_empty
|
57
57
|
end
|
@@ -60,7 +60,7 @@ module Commontator
|
|
60
60
|
sign_in @user
|
61
61
|
|
62
62
|
@user.can_edit = true
|
63
|
-
|
63
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
64
64
|
assert_redirected_to @thread
|
65
65
|
assigns(:thread).errors.must_be_empty
|
66
66
|
assigns(:thread).is_closed?.must_equal true
|
@@ -69,7 +69,7 @@ module Commontator
|
|
69
69
|
assigns(:thread).reopen.must_equal true
|
70
70
|
@user.can_edit = false
|
71
71
|
@user.is_admin = true
|
72
|
-
|
72
|
+
patch :close, :id => @thread.id, :use_route => :commontator
|
73
73
|
assert_redirected_to @thread
|
74
74
|
assigns(:thread).errors.must_be_empty
|
75
75
|
assigns(:thread).is_closed?.must_equal true
|
@@ -78,23 +78,23 @@ module Commontator
|
|
78
78
|
|
79
79
|
it 'wont reopen unless authorized and closed' do
|
80
80
|
@thread.close.must_equal true
|
81
|
-
|
81
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
82
82
|
assert_response 403
|
83
83
|
assigns(:thread).is_closed?.must_equal true
|
84
84
|
|
85
85
|
sign_in @user
|
86
|
-
|
86
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
87
87
|
assert_response 403
|
88
88
|
assigns(:thread).is_closed?.must_equal true
|
89
89
|
|
90
90
|
@user.can_read = true
|
91
|
-
|
91
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
92
92
|
assert_response 403
|
93
93
|
assigns(:thread).is_closed?.must_equal true
|
94
94
|
|
95
95
|
@thread.reopen.must_equal true
|
96
96
|
@user.can_edit = true
|
97
|
-
|
97
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
98
98
|
assert_redirected_to @thread
|
99
99
|
assigns(:thread).errors.wont_be_empty
|
100
100
|
end
|
@@ -104,7 +104,7 @@ module Commontator
|
|
104
104
|
|
105
105
|
@thread.close.must_equal true
|
106
106
|
@user.can_edit = true
|
107
|
-
|
107
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
108
108
|
assert_redirected_to @thread
|
109
109
|
assigns(:thread).errors.must_be_empty
|
110
110
|
assigns(:thread).is_closed?.must_equal false
|
@@ -112,7 +112,7 @@ module Commontator
|
|
112
112
|
assigns(:thread).close.must_equal true
|
113
113
|
@user.can_edit = false
|
114
114
|
@user.is_admin = true
|
115
|
-
|
115
|
+
patch :reopen, :id => @thread.id, :use_route => :commontator
|
116
116
|
assert_redirected_to @thread
|
117
117
|
assigns(:thread).errors.must_be_empty
|
118
118
|
assigns(:thread).is_closed?.must_equal false
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
module Commontator
|
4
4
|
describe SubscriptionsMailer do
|
@@ -18,7 +18,7 @@ module Commontator
|
|
18
18
|
it 'must create deliverable mail' do
|
19
19
|
mail = SubscriptionsMailer.comment_created(@comment, @recipients)
|
20
20
|
mail.must_be_instance_of Mail::Message
|
21
|
-
mail.to.
|
21
|
+
mail.to.must_equal 'Undisclosed Recipients'
|
22
22
|
mail.cc.must_be_nil
|
23
23
|
mail.bcc.size.must_equal 1
|
24
24
|
mail.bcc.must_include @user2.email
|
data/spec/dummy/Rakefile
CHANGED
data/spec/dummy/config.ru
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
Bundler.require
|
5
|
+
Bundler.require(*Rails.groups)
|
6
6
|
require "commontator"
|
7
7
|
|
8
8
|
module Dummy
|
@@ -11,16 +11,6 @@ module Dummy
|
|
11
11
|
# Application configuration should go into files in config/initializers
|
12
12
|
# -- all .rb files in that directory are automatically loaded.
|
13
13
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
-
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
-
|
21
|
-
# Activate observers that should always be running.
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
-
|
24
14
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
15
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
16
|
# config.time_zone = 'Central Time (US & Canada)'
|
@@ -29,31 +19,9 @@ module Dummy
|
|
29
19
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
20
|
# config.i18n.default_locale = :de
|
31
21
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
-
config.filter_parameters += [:password]
|
37
|
-
|
38
|
-
# Enable escaping HTML in JSON.
|
39
|
-
config.active_support.escape_html_entities_in_json = true
|
40
|
-
|
41
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
-
# like if you have constraints or database-specific column types
|
44
|
-
# config.active_record.schema_format = :sql
|
45
|
-
|
46
|
-
# Enforce whitelist mode for mass assignment.
|
47
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
-
config.active_record.whitelist_attributes = true
|
51
|
-
|
52
|
-
# Enable the asset pipeline
|
53
|
-
config.assets.enabled = true
|
54
|
-
|
55
|
-
# Version of your assets, change this if you want to expire all your assets
|
56
|
-
config.assets.version = '1.0'
|
22
|
+
config.generators do |g|
|
23
|
+
g.test_framework :mini_test, :spec => true, :fixture => false
|
24
|
+
end
|
57
25
|
end
|
58
26
|
end
|
59
27
|
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Set up gems listed in the Gemfile.
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
3
3
|
|
4
|
-
if File.
|
5
|
-
|
6
|
-
require 'bundler'
|
7
|
-
Bundler.setup
|
8
|
-
end
|
9
|
-
|
10
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
4
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -1,37 +1,29 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
5
|
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
#
|
10
|
-
config.
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports and disable caching
|
12
|
+
# Show full error reports and disable caching.
|
13
13
|
config.consider_all_requests_local = true
|
14
14
|
config.action_controller.perform_caching = false
|
15
15
|
|
16
|
-
# Don't care if the mailer can't send
|
16
|
+
# Don't care if the mailer can't send.
|
17
17
|
config.action_mailer.raise_delivery_errors = false
|
18
18
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
20
|
config.active_support.deprecation = :log
|
21
21
|
|
22
|
-
#
|
23
|
-
config.
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
24
|
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
# Log the query plan for queries taking more than this (works
|
29
|
-
# with SQLite, MySQL, and PostgreSQL)
|
30
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
-
|
32
|
-
# Do not compress assets
|
33
|
-
config.assets.compress = false
|
34
|
-
|
35
|
-
# Expands the lines which load the assets
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
36
28
|
config.assets.debug = true
|
37
29
|
end
|
@@ -1,67 +1,80 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
|
-
# Code is not reloaded between requests
|
4
|
+
# Code is not reloaded between requests.
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
-
#
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
8
14
|
config.consider_all_requests_local = false
|
9
15
|
config.action_controller.perform_caching = true
|
10
16
|
|
11
|
-
#
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
12
23
|
config.serve_static_assets = false
|
13
24
|
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
16
28
|
|
17
|
-
#
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
18
30
|
config.assets.compile = false
|
19
31
|
|
20
|
-
# Generate digests for assets URLs
|
32
|
+
# Generate digests for assets URLs.
|
21
33
|
config.assets.digest = true
|
22
34
|
|
23
|
-
#
|
24
|
-
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
25
37
|
|
26
|
-
# Specifies the header that your server uses for sending files
|
38
|
+
# Specifies the header that your server uses for sending files.
|
27
39
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
40
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
41
|
|
30
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
43
|
# config.force_ssl = true
|
32
44
|
|
33
|
-
#
|
34
|
-
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
35
47
|
|
36
|
-
# Prepend all log lines with the following tags
|
48
|
+
# Prepend all log lines with the following tags.
|
37
49
|
# config.log_tags = [ :subdomain, :uuid ]
|
38
50
|
|
39
|
-
# Use a different logger for distributed setups
|
51
|
+
# Use a different logger for distributed setups.
|
40
52
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
53
|
|
42
|
-
# Use a different cache store in production
|
54
|
+
# Use a different cache store in production.
|
43
55
|
# config.cache_store = :mem_cache_store
|
44
56
|
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
46
58
|
# config.action_controller.asset_host = "http://assets.example.com"
|
47
59
|
|
48
|
-
# Precompile additional assets
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
49
62
|
# config.assets.precompile += %w( search.js )
|
50
63
|
|
51
|
-
#
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
52
66
|
# config.action_mailer.raise_delivery_errors = false
|
53
67
|
|
54
|
-
# Enable threaded mode
|
55
|
-
# config.threadsafe!
|
56
|
-
|
57
68
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation can not be found)
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
59
70
|
config.i18n.fallbacks = true
|
60
71
|
|
61
|
-
# Send deprecation notices to registered listeners
|
72
|
+
# Send deprecation notices to registered listeners.
|
62
73
|
config.active_support.deprecation = :notify
|
63
74
|
|
64
|
-
#
|
65
|
-
#
|
66
|
-
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
67
80
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
5
|
# test suite. You never need to work with it otherwise. Remember that
|
@@ -7,31 +7,30 @@ Dummy::Application.configure do
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
13
14
|
|
14
|
-
#
|
15
|
-
config.
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
16
18
|
|
17
|
-
# Show full error reports and disable caching
|
19
|
+
# Show full error reports and disable caching.
|
18
20
|
config.consider_all_requests_local = true
|
19
21
|
config.action_controller.perform_caching = false
|
20
22
|
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
22
24
|
config.action_dispatch.show_exceptions = false
|
23
25
|
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
26
28
|
|
27
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
28
30
|
# The :test delivery method accumulates sent emails in the
|
29
31
|
# ActionMailer::Base.deliveries array.
|
30
32
|
config.action_mailer.delivery_method = :test
|
31
33
|
|
32
|
-
#
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
-
|
35
|
-
# Print deprecation notices to the stderr
|
34
|
+
# Print deprecation notices to the stderr.
|
36
35
|
config.active_support.deprecation = :stderr
|
37
36
|
end
|