commontator 1.1.1 → 1.1.2

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 (126) hide show
  1. data/README.md +1 -1
  2. data/Rakefile +2 -20
  3. data/lib/commontator.rb +4 -2
  4. data/lib/commontator.rb~ +7 -5
  5. data/lib/commontator/acts_as_commontable.rb +1 -1
  6. data/lib/commontator/acts_as_commontable.rb~ +2 -2
  7. data/lib/commontator/security_transgression.rb +2 -1
  8. data/lib/commontator/security_transgression.rb~ +3 -0
  9. data/lib/commontator/version.rb +1 -1
  10. data/lib/commontator/version.rb~ +1 -1
  11. data/lib/tasks/commontator_tasks.rake +1 -0
  12. data/lib/tasks/commontator_tasks.rake~ +41 -0
  13. data/spec/app/controllers/commontator/comments_controller_spec.rb +1 -1
  14. data/spec/app/controllers/commontator/comments_controller_spec.rb~ +8 -8
  15. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +1 -1
  16. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb~ +1 -1
  17. data/spec/app/controllers/commontator/threads_controller_spec.rb +1 -1
  18. data/spec/app/controllers/commontator/threads_controller_spec.rb~ +110 -110
  19. data/spec/app/helpers/commontator/application_helper_spec.rb +2 -0
  20. data/spec/app/helpers/commontator/application_helper_spec.rb~ +1 -1
  21. data/spec/app/helpers/commontator/threads_helper_spec.rb +1 -1
  22. data/spec/app/helpers/commontator/threads_helper_spec.rb~ +1 -1
  23. data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +1 -1
  24. data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb~ +2 -2
  25. data/spec/app/models/commontator/comment_observer_spec.rb +1 -1
  26. data/spec/app/models/commontator/comment_observer_spec.rb~ +1 -1
  27. data/spec/app/models/commontator/comment_spec.rb +1 -1
  28. data/spec/app/models/commontator/comment_spec.rb~ +1 -1
  29. data/spec/app/models/commontator/subscription_spec.rb +1 -1
  30. data/spec/app/models/commontator/subscription_spec.rb~ +22 -22
  31. data/spec/app/models/commontator/thread_spec.rb +1 -1
  32. data/spec/app/models/commontator/thread_spec.rb~ +2 -2
  33. data/spec/dummy/README.md +1 -1
  34. data/spec/dummy/README.md~ +1 -1
  35. data/spec/dummy/Rakefile~ +7 -0
  36. data/spec/dummy/config/initializers/commontator.rb +1 -1
  37. data/spec/dummy/db/development.sqlite3 +0 -0
  38. data/spec/dummy/db/migrate/{0_create_dummy_models.rb → 1_create_dummy_models.rb} +0 -0
  39. data/spec/dummy/db/migrate/{1_create_dummy_users.rb → 2_create_dummy_users.rb} +0 -0
  40. data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +4 -1
  41. data/spec/dummy/db/schema.rb +3 -0
  42. data/spec/dummy/db/test.sqlite3 +0 -0
  43. data/spec/dummy/log/development.log +466 -15153
  44. data/spec/dummy/log/test.log +7183 -178543
  45. data/spec/lib/commontator/acts_as_commontable_spec.rb +1 -1
  46. data/spec/lib/commontator/acts_as_commontable_spec.rb~ +1 -1
  47. data/spec/lib/commontator/acts_as_commontator_spec.rb +1 -1
  48. data/spec/lib/commontator/acts_as_commontator_spec.rb~ +1 -1
  49. data/spec/lib/commontator/commontable_config_spec.rb +1 -1
  50. data/spec/lib/commontator/commontable_config_spec.rb~ +6 -6
  51. data/spec/lib/commontator/commontator_config_spec.rb +1 -1
  52. data/spec/lib/commontator/commontator_config_spec.rb~ +6 -6
  53. data/spec/lib/commontator/controller_includes_spec.rb +1 -1
  54. data/spec/lib/commontator/controller_includes_spec.rb~ +1 -1
  55. data/spec/lib/commontator/shared_helper_spec.rb +1 -1
  56. data/spec/lib/commontator/shared_helper_spec.rb~ +1 -1
  57. data/spec/lib/commontator_spec.rb +1 -1
  58. data/spec/lib/commontator_spec.rb~ +4 -4
  59. data/spec/{spec_helper.rb → minitest_helper.rb} +0 -1
  60. data/spec/minitest_helper.rb~ +35 -0
  61. data/spec/spec_helper.rb~ +7 -1
  62. metadata +153 -241
  63. data/app/assets/stylesheets/commontator/comments.css~ +0 -83
  64. data/app/assets/stylesheets/commontator/threads.css~ +0 -18
  65. data/app/controllers/commontator/application_controller.rb~ +0 -28
  66. data/app/controllers/commontator/comments_controller.rb~ +0 -135
  67. data/app/controllers/commontator/commontator_controller.rb~ +0 -22
  68. data/app/controllers/commontator/subscriptions_controller.rb~ +0 -33
  69. data/app/controllers/commontator/threads_controller.rb~ +0 -41
  70. data/app/helpers/commontator/comments_helper.rb~ +0 -41
  71. data/app/helpers/commontator/commontator_helper.rb~ +0 -7
  72. data/app/helpers/commontator/subscriptions_helper.rb~ +0 -8
  73. data/app/helpers/commontator/threads_helper.rb~ +0 -22
  74. data/app/mailers/commontator/subscriptions_mailer.rb~ +0 -49
  75. data/app/models/commontator/comment.rb~ +0 -89
  76. data/app/models/commontator/comment_observer.rb~ +0 -13
  77. data/app/models/commontator/subscription.rb~ +0 -19
  78. data/app/models/commontator/thread.rb~ +0 -123
  79. data/app/views/commontator/comments/_actions.html.erb~ +0 -30
  80. data/app/views/commontator/comments/_body.html.erb~ +0 -7
  81. data/app/views/commontator/comments/_form.html.erb~ +0 -36
  82. data/app/views/commontator/comments/_show.html.erb~ +0 -44
  83. data/app/views/commontator/comments/_votes.html.erb~ +0 -57
  84. data/app/views/commontator/comments/delete.js.erb~ +0 -17
  85. data/app/views/commontator/comments/update.js.erb~ +0 -7
  86. data/app/views/commontator/shared/_thread.html.erb~ +0 -20
  87. data/app/views/commontator/shared/_thread_link.html.erb~ +0 -16
  88. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +0 -6
  89. data/app/views/commontator/threads/_show.html.erb~ +0 -61
  90. data/config/initializers/commontator.rb~ +0 -164
  91. data/db/migrate/0_install_commontator.rb~ +0 -48
  92. data/lib/commontator/commontable_config.rb~ +0 -13
  93. data/lib/commontator/commontator_config.rb~ +0 -13
  94. data/lib/commontator/controller_includes.rb~ +0 -23
  95. data/lib/commontator/engine.rb~ +0 -7
  96. data/lib/commontator/shared_helper.rb~ +0 -42
  97. data/lib/commontator/shared_methods.rb~ +0 -24
  98. data/spec/app/controllers/comments_controller_spec.rb~ +0 -7
  99. data/spec/app/controllers/commontator/application_controller_spec.rb~ +0 -30
  100. data/spec/app/controllers/threads_controller_spec.rb~ +0 -12
  101. data/spec/dummy/Gemfile~ +0 -3
  102. data/spec/dummy/app/controllers/application_controller.rb~ +0 -7
  103. data/spec/dummy/app/controllers/dummies_controller.rb~ +0 -17
  104. data/spec/dummy/app/controllers/dummy_models_controller.rb~ +0 -29
  105. data/spec/dummy/app/helpers/application_helper.rb~ +0 -15
  106. data/spec/dummy/app/models/dummy.rb~ +0 -3
  107. data/spec/dummy/app/models/dummy_user.rb~ +0 -9
  108. data/spec/dummy/app/models/user.rb~ +0 -5
  109. data/spec/dummy/app/views/dummy_model/show.html.erb~ +0 -1
  110. data/spec/dummy/config/application.rb~ +0 -59
  111. data/spec/dummy/config/initializers/commontator.rb~ +0 -164
  112. data/spec/dummy/config/routes.rb~ +0 -7
  113. data/spec/dummy/db/migrate/0_create_dummies.rb~ +0 -48
  114. data/spec/dummy/db/migrate/0_create_dummy_models.rb~ +0 -7
  115. data/spec/dummy/db/migrate/1_create_dummy_users.rb~ +0 -7
  116. data/spec/dummy/db/migrate/1_create_users.rb~ +0 -7
  117. data/spec/dummy/db/migrate/2_install_commontator.rb +0 -49
  118. data/spec/dummy/db/migrate/2_install_commontator.rb~ +0 -49
  119. data/spec/dummy/db/schema.rb~ +0 -71
  120. data/spec/dummy/tmp/cache/assets/CCB/1D0/sprockets%2F02d4b791eb831cf2057bf4703a1218d1 +0 -0
  121. data/spec/dummy/tmp/cache/assets/CD1/510/sprockets%2Fc69ee3cc5796188d873574179290a6ef +0 -0
  122. data/spec/dummy/tmp/cache/assets/D01/8B0/sprockets%2F0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
  123. data/spec/dummy/tmp/cache/assets/D06/2F0/sprockets%2Fe1f674c11941d62aac1764ef3a7134e4 +0 -0
  124. data/spec/dummy/tmp/cache/assets/D54/060/sprockets%2Fe85565206c3e5fdf9dfeb367c85557b1 +0 -0
  125. data/spec/dummy/tmp/cache/assets/D9B/550/sprockets%2Fa41c8be5379abec3c0d0d98e2f0d5609 +0 -0
  126. data/spec/dummy/tmp/cache/assets/E01/2E0/sprockets%2Fa3fb9025f90ff05a6fd4afc7ded2692c +0 -0
data/README.md CHANGED
@@ -13,7 +13,7 @@ There are 4 steps you must follow to install commontator:
13
13
  Add this line to your application's Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'commontator', '~> 1.0.0'
16
+ gem 'commontator', '~> 1.1.0'
17
17
  ```
18
18
 
19
19
  And then execute:
data/Rakefile CHANGED
@@ -4,38 +4,20 @@ begin
4
4
  rescue LoadError
5
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
6
  end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
14
-
15
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'Commontator'
18
- rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
20
- rdoc.rdoc_files.include('lib/**/*.rb')
21
- end
22
7
 
23
8
  APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
9
  load 'rails/tasks/engine.rake'
25
10
 
26
-
27
-
28
11
  Bundler::GemHelper.install_tasks
29
12
 
30
13
  require 'rake/testtask'
31
14
 
32
- Rake::TestTask.new(:spec) do |t|
33
- Rake::Task['app:db:test:prepare'].invoke
15
+ Rake::TestTask.new(:test => 'app:db:test:prepare') do |t|
34
16
  t.libs << 'lib'
35
17
  t.libs << 'spec'
36
18
  t.pattern = 'spec/**/*_spec.rb'
37
19
  t.verbose = false
38
20
  end
39
21
 
22
+ task :default => :test
40
23
 
41
- task :default => :spec
data/lib/commontator.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'commontator/engine'
2
+ require 'commontator/controller_includes'
3
+
1
4
  module Commontator
2
5
  # Attributes
3
6
 
@@ -53,7 +56,6 @@ module Commontator
53
56
  end
54
57
  end
55
58
 
56
- require 'commontator/engine'
57
59
  require 'commontator/acts_as_commontator'
58
60
  require 'commontator/acts_as_commontable'
59
- require 'commontator/controller_includes'
61
+
data/lib/commontator.rb~ CHANGED
@@ -1,3 +1,8 @@
1
+ require 'commontator/engine'
2
+ require 'commontator/controller_includes'
3
+ require 'commontator/acts_as_commontator'
4
+ require 'commontator/acts_as_commontable'
5
+
1
6
  module Commontator
2
7
  # Attributes
3
8
 
@@ -11,7 +16,6 @@ module Commontator
11
16
  COMMONTATOR_ATTRIBUTES = [
12
17
  :user_missing_name,
13
18
  :user_name_clickable,
14
- :subscription_emails,
15
19
  :user_email_method,
16
20
  :user_name_method,
17
21
  :user_admin_proc,
@@ -54,7 +58,5 @@ module Commontator
54
58
  end
55
59
  end
56
60
 
57
- require 'commontator/engine'
58
- require 'commontator/acts_as_commontator'
59
- require 'commontator/acts_as_commontable'
60
- require 'commontator/controller_includes'
61
+
62
+
@@ -18,7 +18,7 @@ module Commontator
18
18
  validates_presence_of :thread
19
19
 
20
20
  cattr_accessor :commontable_config
21
- self.commontable_config = Commontator::CommontableConfig.new
21
+ self.commontable_config = Commontator::CommontableConfig.new(options)
22
22
  self.is_commontable = true
23
23
 
24
24
  alias_method :thread_raw, :thread
@@ -24,8 +24,8 @@ module Commontator
24
24
  alias_method :thread_raw, :thread
25
25
 
26
26
  def thread
27
- t = thread_raw
28
- return t unless t.nil?
27
+ raw = thread_raw
28
+ return raw unless raw.nil?
29
29
  return Commontator::Thread.find_or_create_by_commontable_id_and_commontable_type(self.id, self.class.name) \
30
30
  unless self.id.nil?
31
31
  self.thread = Commontator::Thread.new
@@ -1,3 +1,4 @@
1
1
  module Commontator
2
- class SecurityTransgression < StandardError; end
2
+ class SecurityTransgression < StandardError
3
+ end
3
4
  end
@@ -0,0 +1,3 @@
1
+ module Commontator
2
+ class SecurityTransgression < StandardError; end
3
+ end
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -39,3 +39,4 @@ namespace :commontator do
39
39
  end
40
40
  end
41
41
  end
42
+
@@ -0,0 +1,41 @@
1
+ COPY_TASKS = ['assets/images', 'assets/stylesheets', 'views', 'mailers', 'helpers', 'controllers', 'models']
2
+
3
+ namespace :commontator do
4
+ namespace :install do
5
+ desc "Copy initializers from commontator to application"
6
+ task :initializers do
7
+ Dir.glob(File.expand_path('../../../config/initializers/*.rb', __FILE__)) do |file|
8
+ if File.exists?(File.expand_path(File.basename(file), 'config/initializers'))
9
+ print "NOTE: Initializer #{File.basename(file)} from commontator has been skipped. Initializer with the same name already exists.\n"
10
+ else
11
+ cp file, 'config/initializers', :verbose => false
12
+ print "Copied initializer #{File.basename(file)} from commontator\n"
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ namespace :copy do
19
+ COPY_TASKS.each do |path|
20
+ name = File.basename(path)
21
+ desc "Copy #{name} from commontator to application"
22
+ task name.to_sym do
23
+ cp_r File.expand_path("../../../app/#{path}/commontator", __FILE__), "app/#{path}", :verbose => false
24
+ print "Copied #{name} from commontator\n"
25
+ end
26
+ end
27
+ end
28
+
29
+ desc "Copy initializers and migrations from commontator to application"
30
+ task :install do
31
+ Rake::Task["commontator:install:initializers"].invoke
32
+ Rake::Task["commontator:install:migrations"].invoke
33
+ end
34
+
35
+ desc "Copy assets, views, mailers, helpers, controllers and models from commontator to application"
36
+ task :copy do
37
+ COPY_TASKS.each do |path|
38
+ Rake::Task["commontator:copy:#{File.basename(path)}"].invoke
39
+ end
40
+ end
41
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'minitest_helper'
2
2
  require 'acts_as_votable'
3
3
 
4
4
  module Commontator
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
  require 'acts_as_votable'
3
3
 
4
4
  module Commontator
5
- describe Commontator::CommentsController do
5
+ describe CommentsController do
6
6
  before do
7
7
  setup_controller_spec
8
- @comment = Commontator::Comment.new
8
+ @comment = Comment.new
9
9
  @comment.thread = @thread
10
10
  @comment.creator = @user
11
11
  @comment.body = 'Something'
@@ -114,7 +114,7 @@ module Commontator
114
114
  @user.can_edit = true
115
115
  @user.is_admin = true
116
116
  sign_in @user
117
- comment2 = Commontator::Comment.new
117
+ comment2 = Comment.new
118
118
  comment2.thread = @thread
119
119
  comment2.creator = @user
120
120
  comment2.body = 'Something else'
@@ -170,7 +170,7 @@ module Commontator
170
170
  @user.can_edit = true
171
171
  @user.is_admin = true
172
172
  sign_in @user
173
- comment2 = Commontator::Comment.new
173
+ comment2 = Comment.new
174
174
  comment2.thread = @thread
175
175
  comment2.creator = @user
176
176
  comment2.body = 'Something else'
@@ -220,7 +220,7 @@ module Commontator
220
220
  assert_redirected_to @thread
221
221
  assigns(:comment).errors.wont_be_empty
222
222
 
223
- comment2 = Commontator::Comment.new
223
+ comment2 = Comment.new
224
224
  comment2.thread = @thread
225
225
  comment2.creator = @user
226
226
  comment2.body = 'Something else'
@@ -243,7 +243,7 @@ module Commontator
243
243
 
244
244
  user2 = DummyUser.create
245
245
  sign_in user2
246
- comment2 = Commontator::Comment.new
246
+ comment2 = Comment.new
247
247
  comment2.thread = @thread
248
248
  comment2.creator = @user
249
249
  comment2.body = 'Something else'
@@ -290,7 +290,7 @@ module Commontator
290
290
  assert_response 403
291
291
  assigns(:comment).is_deleted?.must_equal true
292
292
 
293
- comment2 = Commontator::Comment.new
293
+ comment2 = Comment.new
294
294
  comment2.thread = @thread
295
295
  comment2.creator = @user
296
296
  comment2.body = 'Something else'
@@ -314,7 +314,7 @@ module Commontator
314
314
 
315
315
  user2 = DummyUser.create
316
316
  sign_in user2
317
- comment2 = Commontator::Comment.new
317
+ comment2 = Comment.new
318
318
  comment2.thread = @thread
319
319
  comment2.creator = @user
320
320
  comment2.body = 'Something else'
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'minitest_helper'
2
2
 
3
3
  module Commontator
4
4
  describe SubscriptionsController do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Commontator
4
- describe Commontator::SubscriptionsController do
4
+ describe SubscriptionsController do
5
5
  before do
6
6
  setup_controller_spec
7
7
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'minitest_helper'
2
2
 
3
3
  module Commontator
4
4
  describe ThreadsController do
@@ -1,121 +1,121 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Commontator
4
- describe ThreadsController do
5
- before do
6
- setup_controller_spec
7
- end
8
-
9
- it 'wont show unless authorized' do
10
- get :show, :id => @thread.id, :use_route => :commontator
11
- assert_response 403
12
-
13
- sign_in @user
14
- get :show, :id => @thread.id, :use_route => :commontator
15
- assert_response 403
16
- end
17
-
18
- it 'must show if authorized' do
19
- commontable_path = Rails.application.routes.url_helpers.dummy_model_path(@commontable)
20
- sign_in @user
21
-
22
- @user.can_read = true
23
- get :show, :id => @thread.id, :use_route => :commontator
24
- assert_redirected_to commontable_path
4
+ describe ThreadsController do
5
+ before do
6
+ setup_controller_spec
7
+ end
25
8
 
26
- @user.can_read = false
27
- @user.can_edit = true
28
- get :show, :id => @thread.id, :use_route => :commontator
29
- assert_redirected_to commontable_path
9
+ it 'wont show unless authorized' do
10
+ get :show, :id => @thread.id, :use_route => :commontator
11
+ assert_response 403
12
+
13
+ sign_in @user
14
+ get :show, :id => @thread.id, :use_route => :commontator
15
+ assert_response 403
16
+ end
30
17
 
31
- @user.can_edit = false
32
- @user.is_admin = true
33
- get :show, :id => @thread.id, :use_route => :commontator
34
- assert_redirected_to commontable_path
35
- end
36
-
37
- it 'wont close unless authorized and open' do
38
- put :close, :id => @thread.id, :use_route => :commontator
39
- assert_response 403
40
- assigns(:thread).is_closed?.must_equal false
41
-
42
- sign_in @user
43
- put :close, :id => @thread.id, :use_route => :commontator
44
- assert_response 403
45
- assigns(:thread).is_closed?.must_equal false
18
+ it 'must show if authorized' do
19
+ commontable_path = Rails.application.routes.url_helpers.dummy_model_path(@commontable)
20
+ sign_in @user
21
+
22
+ @user.can_read = true
23
+ get :show, :id => @thread.id, :use_route => :commontator
24
+ assert_redirected_to commontable_path
25
+
26
+ @user.can_read = false
27
+ @user.can_edit = true
28
+ get :show, :id => @thread.id, :use_route => :commontator
29
+ assert_redirected_to commontable_path
30
+
31
+ @user.can_edit = false
32
+ @user.is_admin = true
33
+ get :show, :id => @thread.id, :use_route => :commontator
34
+ assert_redirected_to commontable_path
35
+ end
46
36
 
47
- @user.can_read = true
48
- put :close, :id => @thread.id, :use_route => :commontator
49
- assert_response 403
50
- assigns(:thread).is_closed?.must_equal false
37
+ it 'wont close unless authorized and open' do
38
+ put :close, :id => @thread.id, :use_route => :commontator
39
+ assert_response 403
40
+ assigns(:thread).is_closed?.must_equal false
41
+
42
+ sign_in @user
43
+ put :close, :id => @thread.id, :use_route => :commontator
44
+ assert_response 403
45
+ assigns(:thread).is_closed?.must_equal false
46
+
47
+ @user.can_read = true
48
+ put :close, :id => @thread.id, :use_route => :commontator
49
+ assert_response 403
50
+ assigns(:thread).is_closed?.must_equal false
51
+
52
+ @user.can_edit = true
53
+ @thread.close.must_equal true
54
+ put :close, :id => @thread.id, :use_route => :commontator
55
+ assert_redirected_to @thread
56
+ assigns(:thread).errors.wont_be_empty
57
+ end
51
58
 
52
- @user.can_edit = true
53
- @thread.close.must_equal true
54
- put :close, :id => @thread.id, :use_route => :commontator
55
- assert_redirected_to @thread
56
- assigns(:thread).errors.wont_be_empty
57
- end
58
-
59
- it 'must close if authorized and open' do
60
- sign_in @user
59
+ it 'must close if authorized and open' do
60
+ sign_in @user
61
+
62
+ @user.can_edit = true
63
+ put :close, :id => @thread.id, :use_route => :commontator
64
+ assert_redirected_to @thread
65
+ assigns(:thread).errors.must_be_empty
66
+ assigns(:thread).is_closed?.must_equal true
67
+ assigns(:thread).closer.must_equal @user
68
+
69
+ assigns(:thread).reopen.must_equal true
70
+ @user.can_edit = false
71
+ @user.is_admin = true
72
+ put :close, :id => @thread.id, :use_route => :commontator
73
+ assert_redirected_to @thread
74
+ assigns(:thread).errors.must_be_empty
75
+ assigns(:thread).is_closed?.must_equal true
76
+ assigns(:thread).closer.must_equal @user
77
+ end
61
78
 
62
- @user.can_edit = true
63
- put :close, :id => @thread.id, :use_route => :commontator
64
- assert_redirected_to @thread
65
- assigns(:thread).errors.must_be_empty
66
- assigns(:thread).is_closed?.must_equal true
67
- assigns(:thread).closer.must_equal @user
79
+ it 'wont reopen unless authorized and closed' do
80
+ @thread.close.must_equal true
81
+ put :reopen, :id => @thread.id, :use_route => :commontator
82
+ assert_response 403
83
+ assigns(:thread).is_closed?.must_equal true
84
+
85
+ sign_in @user
86
+ put :reopen, :id => @thread.id, :use_route => :commontator
87
+ assert_response 403
88
+ assigns(:thread).is_closed?.must_equal true
89
+
90
+ @user.can_read = true
91
+ put :reopen, :id => @thread.id, :use_route => :commontator
92
+ assert_response 403
93
+ assigns(:thread).is_closed?.must_equal true
94
+
95
+ @thread.reopen.must_equal true
96
+ @user.can_edit = true
97
+ put :reopen, :id => @thread.id, :use_route => :commontator
98
+ assert_redirected_to @thread
99
+ assigns(:thread).errors.wont_be_empty
100
+ end
68
101
 
69
- assigns(:thread).reopen.must_equal true
70
- @user.can_edit = false
71
- @user.is_admin = true
72
- put :close, :id => @thread.id, :use_route => :commontator
73
- assert_redirected_to @thread
74
- assigns(:thread).errors.must_be_empty
75
- assigns(:thread).is_closed?.must_equal true
76
- assigns(:thread).closer.must_equal @user
102
+ it 'must reopen if authorized and closed' do
103
+ sign_in @user
104
+
105
+ @thread.close.must_equal true
106
+ @user.can_edit = true
107
+ put :reopen, :id => @thread.id, :use_route => :commontator
108
+ assert_redirected_to @thread
109
+ assigns(:thread).errors.must_be_empty
110
+ assigns(:thread).is_closed?.must_equal false
111
+
112
+ assigns(:thread).close.must_equal true
113
+ @user.can_edit = false
114
+ @user.is_admin = true
115
+ put :reopen, :id => @thread.id, :use_route => :commontator
116
+ assert_redirected_to @thread
117
+ assigns(:thread).errors.must_be_empty
118
+ assigns(:thread).is_closed?.must_equal false
119
+ end
77
120
  end
78
-
79
- it 'wont reopen unless authorized and closed' do
80
- @thread.close.must_equal true
81
- put :reopen, :id => @thread.id, :use_route => :commontator
82
- assert_response 403
83
- assigns(:thread).is_closed?.must_equal true
84
-
85
- sign_in @user
86
- put :reopen, :id => @thread.id, :use_route => :commontator
87
- assert_response 403
88
- assigns(:thread).is_closed?.must_equal true
89
-
90
- @user.can_read = true
91
- put :reopen, :id => @thread.id, :use_route => :commontator
92
- assert_response 403
93
- assigns(:thread).is_closed?.must_equal true
94
-
95
- @thread.reopen.must_equal true
96
- @user.can_edit = true
97
- put :reopen, :id => @thread.id, :use_route => :commontator
98
- assert_redirected_to @thread
99
- assigns(:thread).errors.wont_be_empty
100
- end
101
-
102
- it 'must reopen if authorized and closed' do
103
- sign_in @user
104
-
105
- @thread.close.must_equal true
106
- @user.can_edit = true
107
- put :reopen, :id => @thread.id, :use_route => :commontator
108
- assert_redirected_to @thread
109
- assigns(:thread).errors.must_be_empty
110
- assigns(:thread).is_closed?.must_equal false
111
-
112
- assigns(:thread).close.must_equal true
113
- @user.can_edit = false
114
- @user.is_admin = true
115
- put :reopen, :id => @thread.id, :use_route => :commontator
116
- assert_redirected_to @thread
117
- assigns(:thread).errors.must_be_empty
118
- assigns(:thread).is_closed?.must_equal false
119
- end
120
- end
121
121
  end