commontator 4.10.4 → 4.10.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/config/locales/ru.yml +78 -0
  4. data/lib/commontator/version.rb +1 -1
  5. data/spec/dummy/db/development.sqlite3 +0 -0
  6. data/spec/dummy/db/test.sqlite3 +0 -0
  7. data/spec/dummy/log/development.log +119 -33
  8. data/spec/dummy/log/test.log +33201 -33045
  9. data/spec/dummy/tmp/cache/assets/test/sprockets/{02d4b791eb831cf2057bf4703a1218d1 → 72b63dddbc5c995f79af8e3c94904fd9} +0 -0
  10. data/spec/dummy/tmp/cache/assets/test/sprockets/{c69ee3cc5796188d873574179290a6ef → a473b3873e554893372a53d71f5e9879} +0 -0
  11. data/spec/dummy/tmp/cache/assets/test/sprockets/{e85565206c3e5fdf9dfeb367c85557b1 → a77b1a9223d168112e1705c29220116f} +0 -0
  12. data/spec/dummy/tmp/cache/assets/test/sprockets/{a3fb9025f90ff05a6fd4afc7ded2692c → afa63eb365bdf4f42584b17ac9176b9d} +0 -0
  13. data/spec/dummy/tmp/cache/assets/test/sprockets/{0f196a1a50363b0a076ec6e1ee5417f6 → d2244ccef8e05bb993f75715af0344cc} +0 -0
  14. data/spec/dummy/tmp/cache/assets/test/sprockets/decb63cac838a5314aa0c22a979f5ac9 +0 -0
  15. data/spec/dummy/tmp/cache/assets/test/sprockets/{e1f674c11941d62aac1764ef3a7134e4 → f721383d531f067d82b071e14aed7a92} +0 -0
  16. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/2MuTpyqaQLj1O4wgROKGqNe4lXIGrVZDYXCWWWMRmrA.cache +0 -0
  17. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/4CjNCL1K4fowKckGvL9F3HkCEtCH42rfsn2geU5A1xs.cache +0 -0
  18. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/CT_fvD-uYyN5f1Kis6kQ7DNUnwtnSVT1sdDKxW1e4hw.cache +1 -0
  19. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/CjR916jO_S7Mo8eTI1vKieKJoKQ0t-bk4sxhcYYQ5Bw.cache +1 -0
  20. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/DtzP3rNdkPulzFug4nVQunOws8OXjvPJwB2nNhp9Scs.cache +0 -0
  21. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/E6KZN1luOC7jAKXFS_xo-XOd5H41vK-eeCsj8MITJHA.cache +0 -0
  22. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/FmvRMZstlcKHCKy5g4mmAu4vjz-YPScTigFnnvs1v-E.cache +1 -0
  23. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/HXtFVXhiLFEohXrf9PBX2u9xkPew5yU2IOyxmFCa7fo.cache +2 -0
  24. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/Kg9VuIGtHRNvM4_TXG3EmqpEWzfEY1kQUI1Mx8AHklY.cache +0 -0
  25. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/Kqg37VotFbWELQyr3-R20M2yWWoiloqBWDWRG-i3m5E.cache +2 -0
  26. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/PeZjQ1KGvso4tt6qvVQZniMzlTlVTWeH-tjln1fERkw.cache +1 -0
  27. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/SN7TWtuyq1ZblzWxqqcr26s_vanAr5PyZ8q_w8IxIPE.cache +1 -0
  28. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/VH5BWA_SC2XnIxStJ5vtjX3pNqdbo7uMo9Tg9GVFUGU.cache +1 -0
  29. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/lzmR_-kjjgHYgaJd_fvBlAimt7_xADtnhEPo_CIBiPM.cache +1 -0
  30. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/q3giWdNvlLQ39xIHQWPY8vzbfjW9zXkSqwibRQBKcvM.cache +2 -0
  31. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/zpCVMbdGU9JtJWkk95WWomNsxP3Q7jqZmWKJXnsGH0g.cache +2 -0
  32. data/spec/spec_helper.rb +10 -3
  33. metadata +100 -171
  34. data/app/models/commontator/subscription.rb~ +0 -23
  35. data/lib/commontator/version.rb~ +0 -3
  36. data/spec/controllers/commontator/comments_controller_spec.rb~ +0 -565
  37. data/spec/controllers/commontator/subscriptions_controller_spec.rb~ +0 -101
  38. data/spec/controllers/commontator/threads_controller_spec.rb~ +0 -130
  39. data/spec/dummy/README.md~ +0 -3
  40. data/spec/dummy/Rakefile~ +0 -6
  41. data/spec/dummy/app/assets/javascripts/application.js~ +0 -15
  42. data/spec/dummy/app/assets/stylesheets/application.css~ +0 -13
  43. data/spec/dummy/app/controllers/application_controller.rb~ +0 -3
  44. data/spec/dummy/app/controllers/dummy_models_controller.rb~ +0 -34
  45. data/spec/dummy/app/helpers/application_helper.rb~ +0 -15
  46. data/spec/dummy/app/models/dummy_model.rb~ +0 -3
  47. data/spec/dummy/app/models/dummy_user.rb~ +0 -13
  48. data/spec/dummy/app/views/dummy_model/show.html.erb~ +0 -1
  49. data/spec/dummy/app/views/layouts/application.html.erb~ +0 -14
  50. data/spec/dummy/config.ru~ +0 -4
  51. data/spec/dummy/config/application.rb~ +0 -26
  52. data/spec/dummy/config/boot.rb~ +0 -5
  53. data/spec/dummy/config/database.yml~ +0 -25
  54. data/spec/dummy/config/environment.rb~ +0 -5
  55. data/spec/dummy/config/environments/development.rb~ +0 -31
  56. data/spec/dummy/config/environments/production.rb~ +0 -82
  57. data/spec/dummy/config/environments/test.rb~ +0 -40
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb~ +0 -7
  59. data/spec/dummy/config/initializers/commontator.rb~ +0 -14
  60. data/spec/dummy/config/initializers/filter_parameter_logging.rb~ +0 -4
  61. data/spec/dummy/config/initializers/inflections.rb~ +0 -16
  62. data/spec/dummy/config/initializers/mime_types.rb~ +0 -5
  63. data/spec/dummy/config/initializers/secret_token.rb~ +0 -12
  64. data/spec/dummy/config/initializers/session_store.rb~ +0 -3
  65. data/spec/dummy/config/initializers/wrap_parameters.rb~ +0 -14
  66. data/spec/dummy/config/routes.rb~ +0 -7
  67. data/spec/dummy/db/migrate/1_create_dummy_models.rb~ +0 -7
  68. data/spec/dummy/db/migrate/2_create_dummy_users.rb~ +0 -7
  69. data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb~ +0 -27
  70. data/spec/dummy/public/404.html~ +0 -26
  71. data/spec/dummy/public/422.html~ +0 -26
  72. data/spec/dummy/public/500.html~ +0 -25
  73. data/spec/dummy/script/rails~ +0 -6
  74. data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
  75. data/spec/helpers/commontator/application_helper_spec.rb~ +0 -9
  76. data/spec/lib/commontator/acts_as_commontable_spec.rb~ +0 -25
  77. data/spec/lib/commontator/acts_as_commontator_spec.rb~ +0 -52
  78. data/spec/lib/commontator/commontable_config_spec.rb~ +0 -29
  79. data/spec/lib/commontator/commontator_config_spec.rb~ +0 -29
  80. data/spec/lib/commontator/controller_includes_spec.rb~ +0 -18
  81. data/spec/lib/commontator/shared_helper_spec.rb~ +0 -22
  82. data/spec/lib/commontator_spec.rb~ +0 -26
  83. data/spec/mailers/commontator/subscriptions_mailer_spec.rb~ +0 -30
  84. data/spec/models/commontator/comment_spec.rb~ +0 -82
  85. data/spec/models/commontator/subscription_spec.rb~ +0 -38
  86. data/spec/models/commontator/thread_spec.rb~ +0 -122
  87. data/spec/rails_helper.rb~ +0 -74
  88. data/spec/spec_helper.rb~ +0 -86
@@ -1,101 +0,0 @@
1
- require 'rails_helper'
2
-
3
- module Commontator
4
- RSpec.describe SubscriptionsController, type: :controller do
5
- routes { Commontator::Engine.routes }
6
-
7
- before(:each) do
8
- setup_controller_spec
9
- end
10
-
11
- it "won't subscribe unless authorized" do
12
- put :subscribe, :id => @thread.id
13
- expect(response).to have_http_status(:forbidden)
14
- expect(@thread.subscription_for(nil)).to be_nil
15
- expect(@thread.subscription_for(@user)).to be_nil
16
-
17
- sign_in @user
18
- put :subscribe, :id => @thread.id
19
- expect(response).to have_http_status(:forbidden)
20
- expect(@thread.subscription_for(@user)).to be_nil
21
-
22
- @thread.subscribe(@user)
23
- @user.can_read = true
24
- put :subscribe, :id => @thread.id
25
- expect(response).to redirect_to(@thread)
26
- expect(assigns(:thread).errors).not_to be_empty
27
- end
28
-
29
- it 'must subscribe if authorized' do
30
- sign_in @user
31
-
32
- @user.can_read = true
33
- put :subscribe, :id => @thread.id
34
- expect(response).to redirect_to(@thread)
35
- expect(assigns(:thread).errors).to be_empty
36
- expect(@thread.subscription_for(@user)).not_to be_nil
37
-
38
- @thread.unsubscribe(@user)
39
- @user.can_read = false
40
- @user.can_edit = true
41
- put :subscribe, :id => @thread.id
42
- expect(response).to redirect_to(@thread)
43
- expect(assigns(:thread).errors).to be_empty
44
- expect(@thread.subscription_for(@user)).not_to be_nil
45
-
46
- @thread.unsubscribe(@user)
47
- @user.can_edit = false
48
- @user.is_admin = true
49
- put :subscribe, :id => @thread.id
50
- expect(response).to redirect_to(@thread)
51
- expect(assigns(:thread).errors).to be_empty
52
- expect(@thread.subscription_for(@user)).not_to be_nil
53
- end
54
-
55
- it "won't unsubscribe unless authorized" do
56
- @thread.subscribe(@user)
57
- put :unsubscribe, :id => @thread.id
58
- expect(response).to have_http_status(:forbidden)
59
- expect(@thread.subscription_for(nil)).to be_nil
60
- expect(@thread.subscription_for(@user)).not_to be_nil
61
-
62
- sign_in @user
63
- put :unsubscribe, :id => @thread.id
64
- expect(response).to have_http_status(:forbidden)
65
- expect(@thread.subscription_for(@user)).not_to be_nil
66
-
67
- @thread.unsubscribe(@user)
68
- @user.can_read = true
69
- put :unsubscribe, :id => @thread.id
70
- expect(response).to redirect_to(@thread)
71
- expect(assigns(:thread).errors).not_to be_empty
72
- end
73
-
74
- it 'must unsubscribe if authorized' do
75
- sign_in @user
76
-
77
- @thread.subscribe(@user)
78
- @user.can_read = true
79
- put :unsubscribe, :id => @thread.id
80
- expect(response).to redirect_to(@thread)
81
- expect(assigns(:thread).errors).to be_empty
82
- expect(@thread.subscription_for(@user)).to be_nil
83
-
84
- @thread.subscribe(@user)
85
- @user.can_read = false
86
- @user.can_edit = true
87
- put :unsubscribe, :id => @thread.id
88
- expect(response).to redirect_to(@thread)
89
- expect(assigns(:thread).errors).to be_empty
90
- expect(@thread.subscription_for(@user)).to be_nil
91
-
92
- @thread.subscribe(@user)
93
- @user.can_edit = false
94
- @user.is_admin = true
95
- put :unsubscribe, :id => @thread.id
96
- expect(response).to redirect_to(@thread)
97
- expect(assigns(:thread).errors).to be_empty
98
- expect(@thread.subscription_for(@user)).to be_nil
99
- end
100
- end
101
- end
@@ -1,130 +0,0 @@
1
- require 'rails_helper'
2
-
3
- module Commontator
4
- RSpec.describe ThreadsController, type: :controller do
5
- routes { Commontator::Engine.routes }
6
-
7
- before(:each) do
8
- setup_controller_spec
9
- end
10
-
11
- it "won't show unless authorized" do
12
- get :show, :id => @thread.id
13
- expect(response).to have_http_status(:forbidden)
14
-
15
- sign_in @user
16
- get :show, :id => @thread.id
17
- expect(response).to have_http_status(:forbidden)
18
- end
19
-
20
- it 'must show if authorized' do
21
- commontable_path = Rails.application.routes.url_helpers.dummy_model_path(@commontable)
22
- sign_in @user
23
-
24
- @user.can_read = true
25
- get :show, :id => @thread.id
26
- expect(response).to redirect_to(commontable_path)
27
-
28
- @user.can_read = false
29
- @user.can_edit = true
30
- get :show, :id => @thread.id
31
- expect(response).to redirect_to(commontable_path)
32
-
33
- @user.can_edit = false
34
- @user.is_admin = true
35
- get :show, :id => @thread.id
36
- expect(response).to redirect_to(commontable_path)
37
- end
38
-
39
- it "won't close unless authorized and open" do
40
- put :close, :id => @thread.id
41
- expect(response).to have_http_status(:forbidden)
42
- @thread.reload
43
- expect(@thread.is_closed?).to eq false
44
-
45
- sign_in @user
46
- put :close, :id => @thread.id
47
- expect(response).to have_http_status(:forbidden)
48
- @thread.reload
49
- expect(@thread.is_closed?).to eq false
50
-
51
- @user.can_read = true
52
- put :close, :id => @thread.id
53
- expect(response).to have_http_status(:forbidden)
54
- @thread.reload
55
- expect(@thread.is_closed?).to eq false
56
-
57
- @user.can_edit = true
58
- expect(@thread.close).to eq true
59
- put :close, :id => @thread.id
60
- expect(response).to redirect_to(@thread)
61
- expect(assigns(:thread).errors).not_to be_empty
62
- end
63
-
64
- it 'must close if authorized and open' do
65
- sign_in @user
66
-
67
- @user.can_edit = true
68
- put :close, :id => @thread.id
69
- expect(response).to redirect_to(@thread)
70
- expect(assigns(:thread).errors).to be_empty
71
- expect(assigns(:thread).is_closed?).to eq true
72
- expect(assigns(:thread).closer).to eq @user
73
-
74
- expect(assigns(:thread).reopen).to eq true
75
- @user.can_edit = false
76
- @user.is_admin = true
77
- put :close, :id => @thread.id
78
- expect(response).to redirect_to(@thread)
79
- expect(assigns(:thread).errors).to be_empty
80
- expect(assigns(:thread).is_closed?).to eq true
81
- expect(assigns(:thread).closer).to eq @user
82
- end
83
-
84
- it "won't reopen unless authorized and closed" do
85
- @thread.close.must_equal true
86
- put :reopen, :id => @thread.id
87
- expect(response).to have_http_status(:forbidden)
88
- @thread.reload
89
- expect(@thread.is_closed?).to eq true
90
-
91
- sign_in @user
92
- put :reopen, :id => @thread.id
93
- expect(response).to have_http_status(:forbidden)
94
- @thread.reload
95
- expect(@thread.is_closed?).to eq true
96
-
97
- @user.can_read = true
98
- put :reopen, :id => @thread.id
99
- expect(response).to have_http_status(:forbidden)
100
- @thread.reload
101
- expect(@thread.is_closed?).to eq true
102
-
103
- expect(@thread.reopen).to eq true
104
- @user.can_edit = true
105
- put :reopen, :id => @thread.id
106
- expect(response).to redirect_to(@thread)
107
- expect(assigns(:thread).errors).not_to be_empty
108
- end
109
-
110
- it 'must reopen if authorized and closed' do
111
- sign_in @user
112
-
113
- expect(@thread.close).to eq true
114
- @user.can_edit = true
115
- put :reopen, :id => @thread.id
116
- expect(response).to redirect_to(@thread)
117
- expect(assigns(:thread).errors).to be_empty
118
- expect(assigns(:thread).is_closed?).to eq false
119
-
120
- expect(assigns(:thread).close).to eq true
121
- @user.can_edit = false
122
- @user.is_admin = true
123
- put :reopen, :id => @thread.id
124
- expect(response).to redirect_to(@thread)
125
- expect(assigns(:thread).errors).to be_empty
126
- expect(assigns(:thread).is_closed?).to eq false
127
- end
128
- end
129
- end
130
-
@@ -1,3 +0,0 @@
1
- ## Dummy
2
-
3
- A dummy application used to test the Commontator engine.
data/spec/dummy/Rakefile~ DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,34 +0,0 @@
1
- class DummyModelsController < ActionController::Base
2
- before_filter :get_dummy
3
-
4
- def self.params
5
- {}
6
- end
7
-
8
- def hide
9
- render :show
10
- end
11
-
12
- def show
13
- commontator_thread_show(@dummy_model)
14
- end
15
-
16
- def url_options
17
- return Hash.new if request.nil?
18
- super
19
- end
20
-
21
- def view_context
22
- view_context = view_context_class.new
23
- view_context.view_paths = view_paths
24
- view_context.controller = self
25
- view_context
26
- end
27
-
28
- protected
29
-
30
- def get_dummy
31
- @dummy_model = DummyModel.find(params[:id])
32
- end
33
- end
34
-
@@ -1,15 +0,0 @@
1
- module ApplicationHelper
2
- @@user = nil
3
-
4
- def current_user
5
- @@user
6
- end
7
-
8
- def sign_in(user)
9
- @@user = user
10
- end
11
-
12
- def sign_out
13
- @@user = nil
14
- end
15
- end
@@ -1,3 +0,0 @@
1
- class DummyModel < ActiveRecord::Base
2
- acts_as_commontable
3
- end
@@ -1,13 +0,0 @@
1
- class DummyUser < ActiveRecord::Base
2
- acts_as_commontator
3
-
4
- attr_accessor :is_admin, :can_edit, :can_read
5
-
6
- def email
7
- "dummy_user#{id}@example.com"
8
- end
9
-
10
- def name
11
- "Dummy User ##{id}"
12
- end
13
- end
@@ -1 +0,0 @@
1
- <%= commontator_thread(@dummy_model) %>
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,26 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require(*Rails.groups)
6
- require 'commontator'
7
-
8
- module Dummy
9
- class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
- # config.time_zone = 'Central Time (US & Canada)'
17
-
18
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
- # config.i18n.default_locale = :de
21
-
22
- config.generators do |g|
23
- g.test_framework :mini_test, :spec => true, :fixture => false
24
- end
25
- end
26
- end
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Dummy::Application.initialize!