commontator 0.5.14 → 1.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.
Files changed (83) hide show
  1. data/README.md +47 -10
  2. data/Rakefile +6 -5
  3. data/app/controllers/commontator/application_controller.rb +3 -1
  4. data/app/controllers/commontator/application_controller.rb~ +5 -2
  5. data/app/controllers/commontator/comments_controller.rb +9 -10
  6. data/app/controllers/commontator/comments_controller.rb~ +9 -10
  7. data/app/controllers/commontator/commontator_controller.rb~ +22 -0
  8. data/app/controllers/commontator/subscriptions_controller.rb +2 -2
  9. data/app/controllers/commontator/subscriptions_controller.rb~ +3 -3
  10. data/app/controllers/commontator/threads_controller.rb +4 -3
  11. data/app/controllers/commontator/threads_controller.rb~ +5 -3
  12. data/app/helpers/commontator/commontator_helper.rb~ +7 -0
  13. data/app/mailers/commontator/subscriptions_mailer.rb +2 -1
  14. data/app/mailers/commontator/subscriptions_mailer.rb~ +3 -1
  15. data/app/models/commontator/comment.rb +13 -9
  16. data/app/models/commontator/comment.rb~ +14 -10
  17. data/app/models/commontator/subscription.rb +3 -3
  18. data/app/models/commontator/subscription.rb~ +19 -0
  19. data/app/models/commontator/thread.rb +17 -41
  20. data/app/models/commontator/thread.rb~ +119 -0
  21. data/app/views/commontator/shared/_thread.html.erb +4 -1
  22. data/app/views/commontator/shared/_thread.html.erb~ +5 -2
  23. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb +1 -1
  24. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +6 -0
  25. data/config/initializers/commontator.rb +42 -64
  26. data/{test/dummy/config/initializers/commontator.rb → config/initializers/commontator.rb~} +42 -64
  27. data/db/migrate/0_install_commontator.rb +1 -1
  28. data/{test/dummy/db/migrate/1_install_commontator.commontator.rb → db/migrate/0_install_commontator.rb~} +1 -2
  29. data/lib/commontator.rb +7 -12
  30. data/lib/commontator.rb~ +7 -12
  31. data/lib/commontator/commontable_config.rb +1 -1
  32. data/lib/commontator/commontable_config.rb~ +13 -0
  33. data/lib/commontator/commontator_config.rb +1 -1
  34. data/lib/commontator/commontator_config.rb~ +13 -0
  35. data/lib/commontator/controller_includes.rb +1 -0
  36. data/lib/commontator/controller_includes.rb~ +1 -1
  37. data/lib/commontator/security_transgression.rb +3 -0
  38. data/{test/dummy/public/favicon.ico → lib/commontator/security_transgression.rb~} +0 -0
  39. data/lib/commontator/shared_helper.rb +1 -1
  40. data/lib/commontator/shared_helper.rb~ +2 -2
  41. data/lib/commontator/version.rb +1 -1
  42. data/lib/commontator/version.rb~ +1 -1
  43. metadata +46 -89
  44. data/test/commontator_test.rb +0 -7
  45. data/test/dummy/README.rdoc +0 -261
  46. data/test/dummy/Rakefile +0 -7
  47. data/test/dummy/app/assets/javascripts/application.js +0 -15
  48. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  49. data/test/dummy/app/controllers/application_controller.rb +0 -3
  50. data/test/dummy/app/helpers/application_helper.rb +0 -2
  51. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  52. data/test/dummy/config.ru +0 -4
  53. data/test/dummy/config/application.rb +0 -59
  54. data/test/dummy/config/boot.rb +0 -10
  55. data/test/dummy/config/database.yml +0 -25
  56. data/test/dummy/config/environment.rb +0 -5
  57. data/test/dummy/config/environments/development.rb +0 -37
  58. data/test/dummy/config/environments/production.rb +0 -67
  59. data/test/dummy/config/environments/test.rb +0 -37
  60. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  61. data/test/dummy/config/initializers/inflections.rb +0 -15
  62. data/test/dummy/config/initializers/mime_types.rb +0 -5
  63. data/test/dummy/config/initializers/secret_token.rb +0 -7
  64. data/test/dummy/config/initializers/session_store.rb +0 -8
  65. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  66. data/test/dummy/config/locales/en.yml +0 -5
  67. data/test/dummy/config/routes.rb +0 -4
  68. data/test/dummy/db/development.sqlite3 +0 -0
  69. data/test/dummy/db/schema.rb +0 -61
  70. data/test/dummy/log/development.log +0 -414
  71. data/test/dummy/public/404.html +0 -26
  72. data/test/dummy/public/422.html +0 -26
  73. data/test/dummy/public/500.html +0 -25
  74. data/test/dummy/script/rails +0 -6
  75. data/test/functional/comments_controller_test.rb +0 -181
  76. data/test/functional/subscriptions_controller_test.rb +0 -122
  77. data/test/integration/navigation_test.rb +0 -10
  78. data/test/test_helper.rb +0 -15
  79. data/test/unit/comment_test.rb +0 -35
  80. data/test/unit/helpers/comments_helper_test.rb +0 -4
  81. data/test/unit/helpers/subscriptions_helper_test.rb +0 -4
  82. data/test/unit/subscription_test.rb +0 -15
  83. data/test/unit/thread_test.rb +0 -57
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,181 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CommentsControllerTest < ActionController::TestCase
4
-
5
- setup do
6
- @comment = FactoryGirl.create(:comment)
7
- @question = @comment.comment_thread.commentable
8
- @user = @comment.creator
9
- FactoryGirl.create(:project_question, :question => @question, :project => Project.default_for_user!(@user))
10
- @published_question = make_simple_question(:method => :create, :published => true)
11
- @published_comment = FactoryGirl.create(:comment,
12
- :comment_thread => @published_question.comment_thread)
13
- end
14
-
15
- test "should not get index not logged in" do
16
- get :index, :question_id => @question.to_param
17
- assert_redirected_to login_path
18
- end
19
-
20
- test "should not get index not authorized" do
21
- user_login
22
- get :index, :question_id => @question.to_param
23
- assert_response(403)
24
- end
25
-
26
- test "should get index" do
27
- sign_in @user
28
- get :index, :question_id => @question.to_param
29
- assert_response :success
30
- end
31
-
32
- test "should get index published question" do
33
- user_login
34
- get :index, :question_id => @published_question.to_param
35
- assert_response :success
36
- end
37
-
38
- test "should not get new not logged in" do
39
- get :new, :question_id => @question.to_param
40
- assert_redirected_to login_path
41
- end
42
-
43
- test "should not get new not authorized" do
44
- user_login
45
- get :new, :question_id => @question.to_param
46
- assert_response(403)
47
- end
48
-
49
- test "should get new" do
50
- sign_in @user
51
- get :new, :question_id => @question.to_param
52
- assert_response :success
53
- assert_not_nil assigns(:comments)
54
- end
55
-
56
- test "should get new published question" do
57
- user_login
58
- get :new, :question_id => @published_question.to_param
59
- assert_response :success
60
- assert_not_nil assigns(:comments)
61
- end
62
-
63
- test "should not create comment not logged in" do
64
- assert_difference('Comment.count', 0) do
65
- post :create, :question_id => @question.to_param, :comment => @comment.attributes
66
- end
67
-
68
- assert_redirected_to login_path
69
- end
70
-
71
- test "should not create comment not authorized" do
72
- user_login
73
- assert_difference('Comment.count', 0) do
74
- post :create, :question_id => @question.to_param, :comment => @comment.attributes
75
- end
76
-
77
- assert_response(403)
78
- end
79
-
80
- test "should create comment" do
81
- sign_in @user
82
- assert_difference('Comment.count') do
83
- post :create, :question_id => @question.to_param, :comment => @comment.attributes
84
- end
85
-
86
- assert_redirected_to question_comments_path(@question.to_param)
87
- end
88
-
89
- test "should create comment published question" do
90
- user_login
91
- assert_difference('Comment.count') do
92
- post :create, :question_id => @published_question.to_param, :comment => @comment.attributes
93
- end
94
-
95
- assert_redirected_to question_comments_path(@published_question.to_param)
96
- end
97
-
98
- test "should not show comment not logged in" do
99
- get :show, :id => @comment.to_param
100
- assert_redirected_to login_path
101
- end
102
-
103
- test "should not show comment not authorized" do
104
- user_login
105
- get :show, :id => @comment.to_param
106
- assert_response(403)
107
- end
108
-
109
- test "should show comment" do
110
- sign_in @user
111
- get :show, :id => @comment.to_param
112
- assert_response :success
113
- end
114
-
115
- test "should show comment published question" do
116
- user_login
117
- get :show, :id => @published_comment.to_param
118
- assert_response :success
119
- end
120
-
121
- test "should not get edit not logged in" do
122
- get :edit, :id => @comment.to_param
123
- assert_redirected_to login_path
124
- end
125
-
126
- test "should not get edit not authorized" do
127
- user_login
128
- get :edit, :id => @comment.to_param
129
- assert_response(403)
130
- end
131
-
132
- test "should get edit" do
133
- sign_in @user
134
- get :edit, :id => @comment.to_param
135
- assert_response :success
136
- end
137
-
138
- test "should not update comment not logged in" do
139
- put :update, :id => @comment.to_param
140
- assert_redirected_to login_path
141
- end
142
-
143
- test "should not update comment not authorized" do
144
- user_login
145
- put :update, :id => @comment.to_param
146
- assert_response(403)
147
- end
148
-
149
- test "should update comment" do
150
- sign_in @user
151
- put :update, :id => @comment.to_param
152
- assert_redirected_to question_comments_path(@question.to_param)
153
- end
154
-
155
- test "should not destroy comment not logged in" do
156
- assert_difference('Comment.count', 0) do
157
- delete :destroy, :id => @comment.to_param
158
- end
159
-
160
- assert_redirected_to login_path
161
- end
162
-
163
- test "should not destroy comment not authorized" do
164
- user_login
165
- assert_difference('Comment.count', 0) do
166
- delete :destroy, :id => @comment.to_param
167
- end
168
-
169
- assert_response(403)
170
- end
171
-
172
- test "should destroy comment" do
173
- sign_in @user
174
- assert_difference('Comment.count', -1) do
175
- delete :destroy, :id => @comment.to_param
176
- end
177
-
178
- assert_redirected_to question_comments_path(@question.to_param)
179
- end
180
-
181
- end
@@ -1,122 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SubscriptionsControllerTest < ActionController::TestCase
4
-
5
- setup do
6
- @question = FactoryGirl.create(:simple_question)
7
- @user = FactoryGirl.create(:user)
8
- FactoryGirl.create(:project_question, :question => @question, :project => Project.default_for_user!(@user))
9
- @published_question = make_simple_question(:method => :create, :published => true)
10
- @user2 = FactoryGirl.create(:user)
11
- end
12
-
13
- test "should not get index not logged in" do
14
- get :index
15
- assert_redirected_to login_path
16
- end
17
-
18
- test "should get index" do
19
- user_login
20
- get :index
21
- assert_response :success
22
- end
23
-
24
- test "should not create subscription not logged in" do
25
- assert_difference('Subscription.count', 0) do
26
- get :create, :question_id => @question.to_param
27
- end
28
-
29
- assert_redirected_to login_path
30
- end
31
-
32
- test "should not create subscription not authorized" do
33
- user_login
34
- assert_difference('Subscription.count', 0) do
35
- get :create, :question_id => @question.to_param
36
- end
37
-
38
- assert_response(403)
39
- end
40
-
41
- test "should not create subscription already subscribed" do
42
- sign_in @user
43
- FactoryGirl.create(:subscription,
44
- :user => @user, :thread => @question.thread)
45
- assert_difference('Subscription.count', 0) do
46
- get :create, :question_id => @question.to_param
47
- end
48
-
49
- assert_redirected_to question_comments_path(@question.to_param)
50
- end
51
-
52
- test "should create subscription" do
53
- sign_in @user
54
- assert_difference('Subscription.count') do
55
- get :create, :question_id => @question.to_param
56
- end
57
-
58
- assert_redirected_to question_comments_path(@question.to_param)
59
- end
60
-
61
- test "should create subscription published question" do
62
- user_login
63
- assert_difference('Subscription.count') do
64
- get :create, :question_id => @published_question.to_param
65
- end
66
-
67
- assert_redirected_to question_comments_path(@published_question.to_param)
68
- end
69
-
70
- test "should not destroy comment_thread_subscription not logged in" do
71
- FactoryGirl.create(:comment_thread_subscription,
72
- :user => @user, :comment_thread => @question.comment_thread)
73
- assert_difference('CommentThreadSubscription.count', 0) do
74
- get :destroy, :question_id => @question.to_param
75
- end
76
-
77
- assert_redirected_to login_path
78
- end
79
-
80
- test "should not destroy comment_thread_subscription not authorized" do
81
- user_login
82
- FactoryGirl.create(:comment_thread_subscription,
83
- :user => @user, :comment_thread => @question.comment_thread)
84
- assert_difference('CommentThreadSubscription.count', 0) do
85
- get :destroy, :question_id => @question.to_param
86
- end
87
-
88
- assert_response(403)
89
- end
90
-
91
- test "should not destroy comment_thread_subscription no subscription" do
92
- sign_in @user
93
- assert_difference('CommentThreadSubscription.count', 0) do
94
- get :destroy, :question_id => @question.to_param
95
- end
96
-
97
- assert_redirected_to question_comments_path(@question.to_param)
98
- end
99
-
100
- test "should destroy comment_thread_subscription" do
101
- sign_in @user
102
- FactoryGirl.create(:comment_thread_subscription,
103
- :user => @user, :comment_thread => @question.comment_thread)
104
- assert_difference('CommentThreadSubscription.count', -1) do
105
- get :destroy, :question_id => @question.to_param
106
- end
107
-
108
- assert_redirected_to question_comments_path(@question.to_param)
109
- end
110
-
111
- test "should destroy comment_thread_subscription published question" do
112
- sign_in @user2
113
- FactoryGirl.create(:comment_thread_subscription,
114
- :user => @user2, :comment_thread => @published_question.comment_thread)
115
- assert_difference('CommentThreadSubscription.count', -1) do
116
- get :destroy, :question_id => @published_question.to_param
117
- end
118
-
119
- assert_redirected_to question_comments_path(@published_question.to_param)
120
- end
121
-
122
- end
@@ -1,10 +0,0 @@
1
- require 'test_helper'
2
-
3
- class NavigationTest < ActionDispatch::IntegrationTest
4
- fixtures :all
5
-
6
- # test "the truth" do
7
- # assert true
8
- # end
9
- end
10
-
data/test/test_helper.rb DELETED
@@ -1,15 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
-
7
- Rails.backtrace_cleaner.remove_silencers!
8
-
9
- # Load support files
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
-
12
- # Load fixtures from the engine
13
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
- end
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CommentTest < ActiveSupport::TestCase
4
-
5
- test "cannot mass-assign comment_thread, creator" do
6
- ct = FactoryGirl.create(:comment_thread)
7
- u = FactoryGirl.create(:user)
8
- c = Comment.new(:comment_thread => ct, :creator => u)
9
- assert c.comment_thread != ct
10
- assert c.creator != u
11
- end
12
-
13
- test "is_modified" do
14
- c = FactoryGirl.create(:comment)
15
- assert !c.is_modified?
16
- c.message = 'Another message'
17
- c.save!
18
- assert c.is_modified?
19
- end
20
-
21
- test "must have comment_thread and creator" do
22
- ct = FactoryGirl.create(:comment_thread)
23
- u = FactoryGirl.create(:user)
24
- c = Comment.new(:message => "Some message")
25
- assert !c.save
26
- c.comment_thread = ct
27
- assert !c.save
28
- c.comment_thread = nil
29
- c.creator = u
30
- assert !c.save
31
- c.comment_thread = ct
32
- c.save!
33
- end
34
-
35
- end