community_engine 3.0.0 → 3.2.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 (198) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +4 -1
  3. data/.travis.yml +5 -2
  4. data/CHANGELOG.markdown +270 -0
  5. data/Gemfile +3 -0
  6. data/README.markdown +20 -21
  7. data/Rakefile +8 -6
  8. data/TODO.markdown +3 -0
  9. data/UPGRADING.markdown +46 -36
  10. data/app/assets/javascripts/active_admin.js.coffee +19 -0
  11. data/app/assets/javascripts/ckeditor/configs/ads.js.coffee +175 -0
  12. data/app/assets/javascripts/ckeditor/configs/comments.js.coffee +2 -0
  13. data/app/assets/javascripts/ckeditor/configs/posts.js.coffee +248 -0
  14. data/app/assets/javascripts/ckeditor/rte/rte.ads.js.coffee +7 -0
  15. data/app/assets/javascripts/ckeditor/rte/rte.comments.js.coffee +8 -0
  16. data/app/assets/javascripts/ckeditor/rte/rte.js.coffee +20 -0
  17. data/app/assets/javascripts/ckeditor/rte/rte.posts.js.coffee +14 -0
  18. data/app/assets/javascripts/community_engine.js +114 -123
  19. data/{vendor → app}/assets/javascripts/jcrop/jquery.Jcrop.js +0 -0
  20. data/{vendor → app}/assets/javascripts/jcrop/jquery.color.js +0 -0
  21. data/{vendor → app}/assets/javascripts/tag-it/tag-it.js +0 -0
  22. data/app/assets/stylesheets/active_admin.css.scss +27 -0
  23. data/{vendor → app}/assets/stylesheets/jcrop/Jcrop.gif +0 -0
  24. data/{vendor → app}/assets/stylesheets/jcrop/jquery.Jcrop.min.css +0 -0
  25. data/{vendor → app}/assets/stylesheets/tag-it/tag-it.css +0 -0
  26. data/{vendor → app}/assets/stylesheets/tag-it/tagit.ui-zendesk.css +0 -0
  27. data/app/controllers/activities_controller.rb +4 -4
  28. data/app/controllers/albums_controller.rb +13 -18
  29. data/app/controllers/authorizations_controller.rb +1 -1
  30. data/app/controllers/base_controller.rb +9 -32
  31. data/app/controllers/categories_controller.rb +1 -78
  32. data/app/controllers/clippings_controller.rb +3 -7
  33. data/app/controllers/comments_controller.rb +4 -24
  34. data/app/controllers/events_controller.rb +3 -12
  35. data/app/controllers/favorites_controller.rb +2 -2
  36. data/app/controllers/forums_controller.rb +5 -9
  37. data/app/controllers/invitations_controller.rb +1 -1
  38. data/app/controllers/messages_controller.rb +4 -8
  39. data/app/controllers/moderators_controller.rb +1 -1
  40. data/app/controllers/monitorships_controller.rb +1 -1
  41. data/app/controllers/pages_controller.rb +0 -62
  42. data/app/controllers/password_resets_controller.rb +2 -2
  43. data/app/controllers/photo_manager_controller.rb +3 -3
  44. data/app/controllers/photos_controller.rb +43 -14
  45. data/app/controllers/posts_controller.rb +7 -14
  46. data/app/controllers/rsvps_controller.rb +3 -3
  47. data/app/controllers/sb_posts_controller.rb +20 -20
  48. data/app/controllers/sessions_controller.rb +1 -1
  49. data/app/controllers/tags_controller.rb +4 -52
  50. data/app/controllers/topics_controller.rb +15 -10
  51. data/app/controllers/users_controller.rb +9 -16
  52. data/app/controllers/votes_controller.rb +2 -2
  53. data/app/helpers/base_helper.rb +4 -14
  54. data/app/models/acts_as_taggable_on/tag.rb +9 -41
  55. data/app/models/clipping.rb +1 -1
  56. data/app/models/forum.rb +2 -2
  57. data/app/models/photo.rb +1 -1
  58. data/app/models/post.rb +1 -1
  59. data/app/models/sb_post.rb +19 -15
  60. data/app/models/topic.rb +10 -10
  61. data/app/models/user.rb +1 -1
  62. data/app/policies/active_admin/page_policy.rb +11 -0
  63. data/app/policies/application_policy.rb +59 -0
  64. data/app/policies/post_policy.rb +13 -0
  65. data/app/policies/sb_post_policy.rb +15 -0
  66. data/app/policies/topic_policy.rb +23 -0
  67. data/app/views/ckeditor/pictures/index.html.haml +15 -0
  68. data/app/views/ckeditor/shared/_asset.html.haml +9 -0
  69. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +14 -0
  70. data/app/views/comments/approve.js.haml +1 -1
  71. data/app/views/comments/create.js.erb +1 -1
  72. data/app/views/comments/edit.js.erb +2 -1
  73. data/app/views/events/_subscribe.html.haml +1 -1
  74. data/app/views/forums/show.html.haml +8 -4
  75. data/app/views/posts/show.html.haml +4 -0
  76. data/app/views/sb_posts/_edit_script.js.erb +2 -3
  77. data/app/views/sb_posts/_reply_script.js.erb +2 -4
  78. data/app/views/sb_posts/_sb_post.html.haml +7 -6
  79. data/app/views/sb_posts/create.js.erb +4 -4
  80. data/app/views/sb_posts/edit.js.erb +2 -1
  81. data/app/views/sessions/_menu_item.html.haml +4 -4
  82. data/app/views/shared/_end_javascript.html.haml +1 -2
  83. data/app/views/shared/_login_sidebar.html.haml +2 -2
  84. data/app/views/tags/show.html.haml +3 -3
  85. data/app/views/topics/show.html.haml +1 -1
  86. data/app/views/users/_profile_user_info_sidebar.html.haml +2 -2
  87. data/app/views/users/destroy.js.erb +3 -0
  88. data/app/views/users/new.html.haml +1 -1
  89. data/app/views/users/show.html.haml +1 -1
  90. data/app/views/users/signup_completed.html.haml +1 -1
  91. data/community_engine.gemspec +14 -11
  92. data/config/initializers/active_admin.rb +239 -0
  93. data/config/initializers/ckeditor.rb +8 -0
  94. data/config/initializers/ransack_bootstrap_fix.rb +25 -0
  95. data/config/locales/de-DE.yml +1 -0
  96. data/config/locales/en.yml +3 -0
  97. data/config/routes.rb +14 -19
  98. data/config/spring.rb +1 -0
  99. data/db/migrate/083_create_active_admin_comments.rb +19 -0
  100. data/lib/community_engine.rb +7 -3
  101. data/lib/community_engine/admin/ads.rb +3 -0
  102. data/lib/community_engine/admin/categories.rb +20 -0
  103. data/lib/community_engine/admin/comments.rb +4 -0
  104. data/lib/community_engine/admin/dashboard.rb +38 -0
  105. data/lib/community_engine/admin/events.rb +3 -0
  106. data/lib/community_engine/admin/forums.rb +3 -0
  107. data/lib/community_engine/admin/homepage_features.rb +25 -0
  108. data/lib/community_engine/admin/metro_areas.rb +4 -0
  109. data/lib/community_engine/admin/pages.rb +26 -0
  110. data/lib/community_engine/admin/posts.rb +92 -0
  111. data/lib/community_engine/admin/tags.rb +21 -0
  112. data/lib/community_engine/admin/users.rb +54 -0
  113. data/lib/community_engine/authenticated_system.rb +5 -20
  114. data/lib/community_engine/engine.rb +5 -0
  115. data/lib/community_engine/version.rb +1 -1
  116. data/lib/resource_feeder/atom.rb +2 -0
  117. data/lib/resource_feeder/rss.rb +2 -0
  118. data/lib/white_list.rb +6 -11
  119. data/test/fixtures/events.yml +10 -0
  120. data/test/fixtures/tags.yml +6 -5
  121. data/test/functional/activities_controller_test.rb +19 -19
  122. data/test/functional/admin/posts_controller_test.rb +16 -0
  123. data/test/functional/admin_controller_test.rb +82 -82
  124. data/test/functional/categories_controller_test.rb +0 -39
  125. data/test/functional/comments_controller_test.rb +14 -7
  126. data/test/functional/favorites_controller_test.rb +15 -16
  127. data/test/functional/pages_controller_test.rb +0 -71
  128. data/test/functional/posts_controller_test.rb +21 -2
  129. data/test/functional/sb_posts_controller_test.rb +3 -3
  130. data/test/functional/sessions_controller_test.rb +2 -2
  131. data/test/functional/tags_controller_test.rb +9 -20
  132. data/test/functional/users_controller_test.rb +0 -8
  133. data/test/functional/votes_controller_test.rb +1 -1
  134. data/test/testapp/config/spring.rb +1 -0
  135. data/test/testapp/db/schema.rb +16 -1
  136. data/test/unit/event_test.rb +1 -1
  137. metadata +204 -170
  138. data/CHANGELOG +0 -144
  139. data/app/controllers/admin_controller.rb +0 -80
  140. data/app/controllers/ads_controller.rb +0 -90
  141. data/app/controllers/homepage_features_controller.rb +0 -74
  142. data/app/controllers/metro_areas_controller.rb +0 -74
  143. data/app/controllers/statistics_controller.rb +0 -35
  144. data/app/views/admin/comments.html.haml +0 -53
  145. data/app/views/admin/events.html.haml +0 -26
  146. data/app/views/admin/messages.html.haml +0 -3
  147. data/app/views/admin/update.js.erb +0 -1
  148. data/app/views/admin/users.html.haml +0 -57
  149. data/app/views/ads/_form.html.haml +0 -21
  150. data/app/views/ads/edit.html.haml +0 -7
  151. data/app/views/ads/index.html.haml +0 -29
  152. data/app/views/ads/new.html.haml +0 -6
  153. data/app/views/ads/show.html.haml +0 -19
  154. data/app/views/categories/_form.html.haml +0 -8
  155. data/app/views/categories/edit.html.haml +0 -4
  156. data/app/views/categories/index.html.haml +0 -20
  157. data/app/views/categories/new.html.haml +0 -4
  158. data/app/views/homepage_features/_form.html.haml +0 -6
  159. data/app/views/homepage_features/edit.html.haml +0 -6
  160. data/app/views/homepage_features/index.html.haml +0 -24
  161. data/app/views/homepage_features/new.html.haml +0 -2
  162. data/app/views/homepage_features/show.html.haml +0 -27
  163. data/app/views/metro_areas/_form.html.haml +0 -6
  164. data/app/views/metro_areas/edit.html.haml +0 -8
  165. data/app/views/metro_areas/index.html.haml +0 -21
  166. data/app/views/metro_areas/new.html.haml +0 -6
  167. data/app/views/metro_areas/show.html.haml +0 -14
  168. data/app/views/pages/_form.html.haml +0 -18
  169. data/app/views/pages/edit.html.haml +0 -4
  170. data/app/views/pages/index.html.haml +0 -34
  171. data/app/views/pages/new.html.haml +0 -7
  172. data/app/views/shared/_admin_nav.html.haml +0 -17
  173. data/app/views/shared/_load_tinymce.js.erb +0 -15
  174. data/app/views/statistics/activities.xml.builder +0 -33
  175. data/app/views/statistics/index.html.haml +0 -48
  176. data/app/views/tags/edit.html.haml +0 -12
  177. data/app/views/tags/manage.html.haml +0 -30
  178. data/app/views/users/update.js.erb +0 -1
  179. data/test/functional/ads_controller_test.rb +0 -51
  180. data/test/functional/homepage_features_controller_test.rb +0 -69
  181. data/test/functional/metro_areas_controller_test.rb +0 -63
  182. data/test/functional/statistics_controller_test.rb +0 -18
  183. data/test/unit/acts_as_taggable_on/tag_test.rb +0 -22
  184. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/README +0 -3
  185. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/Rakefile +0 -22
  186. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -34
  187. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/templates/migration.rb +0 -13
  188. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/install.rb +0 -3
  189. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/test/acts_as_publishable_test.rb +0 -8
  190. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/uninstall.rb +0 -1
  191. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/README +0 -4
  192. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/Rakefile +0 -22
  193. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/atom_feed_test.rb +0 -85
  194. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/rss_feed_test.rb +0 -61
  195. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/test_helper.rb +0 -60
  196. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/README +0 -35
  197. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/Rakefile +0 -22
  198. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/test/white_list_test.rb +0 -120
@@ -57,21 +57,6 @@ module AuthenticatedSystem
57
57
  @current_user_session = UserSession.find
58
58
  end
59
59
 
60
- # Check if the user is authorized.
61
- #
62
- # Override this method in your controllers if you want to restrict access
63
- # to only a few actions or if you want to check if the user
64
- # has the correct rights.
65
- #
66
- # Example:
67
- #
68
- # # only allow nonbobs
69
- # def authorize?
70
- # current_user.login != "bob"
71
- # end
72
- def authorized?
73
- true
74
- end
75
60
  def admin?
76
61
  logged_in? && current_user.admin?
77
62
  end
@@ -87,7 +72,7 @@ module AuthenticatedSystem
87
72
  # behavior in case the user is not authorized
88
73
  # to access the requested action. For example, a popup window might
89
74
  # simply close itself.
90
- def access_denied
75
+ def access_denied(exception=nil)
91
76
  respond_to do |accepts|
92
77
  accepts.html do
93
78
  store_location
@@ -120,18 +105,18 @@ module AuthenticatedSystem
120
105
  #
121
106
  # To require logins for all actions, use this in your controllers:
122
107
  #
123
- # before_filter :login_required
108
+ # before_action :login_required
124
109
  #
125
110
  # To require logins for specific actions, use this in your controllers:
126
111
  #
127
- # before_filter :login_required, :only => [ :edit, :update ]
112
+ # before_action :login_required, :only => [ :edit, :update ]
128
113
  #
129
114
  # To skip this in a subclassed controller:
130
115
  #
131
- # skip_before_filter :login_required
116
+ # skip_before_action :login_required
132
117
  #
133
118
  def login_required
134
- logged_in? && authorized? ? true : access_denied
119
+ logged_in? ? true : access_denied
135
120
  end
136
121
 
137
122
  def require_user
@@ -5,9 +5,14 @@ module CommunityEngine
5
5
  class Engine < Rails::Engine
6
6
  engine_name "community_engine"
7
7
 
8
+ config.railties_order = [ CommunityEngine::Engine, :main_app, :all]
9
+
10
+
8
11
  initializer engine_name do |app|
9
12
  require root.join('config','application_config.rb')
10
13
  require app.root.join('config','application_config.rb')
14
+
15
+ ActiveAdmin.application.load_paths += Dir[File.dirname(__FILE__) + '/admin']
11
16
  end
12
17
 
13
18
  initializer "#{engine_name}.initializers", :before => :load_config_initializers do
@@ -1,7 +1,7 @@
1
1
  module CommunityEngine
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 0
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
  BUILD = nil
7
7
 
@@ -1,3 +1,5 @@
1
+ require "builder"
2
+
1
3
  module ResourceFeeder
2
4
  module Atom
3
5
  extend self
@@ -1,3 +1,5 @@
1
+ require "builder"
2
+
1
3
  module ResourceFeeder
2
4
  module Rss
3
5
  extend self
@@ -3,30 +3,25 @@ ActionView::Base.send :include, WhiteListHelper
3
3
  ActiveRecord::Base.send :include, WhiteListHelper
4
4
 
5
5
  ActiveRecord::Base.class_eval do
6
- include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper, ActionView::Helpers::UrlHelper
7
-
6
+ # include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper, ActionView::Helpers::UrlHelper
7
+
8
8
  def self.format_attribute(attr_name)
9
9
  class << self; include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper; end
10
10
  define_method(:body) { read_attribute attr_name }
11
- define_method(:body=) { |value| write_attribute "#{attr_name}", value }
11
+ define_method(:body=) { |value| write_attribute "#{attr_name}", value }
12
12
  define_method(:body_html) { read_attribute "#{attr_name}_html" }
13
13
  define_method(:body_html=) { |value| write_attribute "#{attr_name}_html", value }
14
14
  before_save :format_content
15
15
  end
16
16
 
17
- def dom_id
18
- [self.class.name.downcase.pluralize.dasherize, id] * '-'
19
- end
20
-
21
17
  protected
22
18
  def format_content
23
19
  body.strip! if body.respond_to?(:strip!)
24
20
  self.body_html = body.blank? ? '' : body_html_with_formatting
25
21
  self.body = white_list(self.body)
26
22
  end
27
-
23
+
28
24
  def body_html_with_formatting
29
- body_html = auto_link(body) { |text| truncate(text, :length => 50) }
30
- white_list(body_html)
25
+ white_list(body_html)
31
26
  end
32
- end
27
+ end
@@ -59,3 +59,13 @@ no_rsvp_event:
59
59
  metro_area_id: 1
60
60
  allow_rsvp: false
61
61
 
62
+ event_with_description:
63
+ id: 7
64
+ name: An event with description
65
+ description: <p>I am an event with a very nice description</p>
66
+ created_at: <%= 5.days.ago.iso8601 %>
67
+ updated_at: <%= 5.days.ago.iso8601 %>
68
+ start_time: <%= 13.days.from_now.iso8601 %>
69
+ end_time: <%= (13.days.from_now + 1.hour).iso8601 %>
70
+ user_id: 4
71
+ metro_area_id: 1
@@ -1,19 +1,20 @@
1
1
  general:
2
2
  id: 1
3
3
  name: General
4
-
4
+ taggings_count: 1
5
5
  misc:
6
6
  id: 2
7
7
  name: Misc
8
-
8
+ taggings_count: 1
9
9
  extra:
10
10
  id: 3
11
11
  name: Extra
12
-
12
+ taggings_count: 1
13
13
  special_characters:
14
14
  id: 4
15
15
  name: Svår
16
-
16
+ taggings_count: 1
17
17
  related_to_misc:
18
18
  id: 5
19
- name: Related
19
+ name: Related
20
+ taggings_count: 1
@@ -6,9 +6,9 @@ class ActivitiesControllerTest < ActionController::TestCase
6
6
  test "should get index" do
7
7
  login_as :quentin
8
8
  users(:quentin).track_activity(:updated_profile)
9
-
9
+
10
10
  get :index
11
-
11
+
12
12
  assert_response :success
13
13
  assert assigns(:activities).any?
14
14
  assert assigns(:popular_tags).any?
@@ -19,44 +19,44 @@ class ActivitiesControllerTest < ActionController::TestCase
19
19
  get :network, :user_id => users(:quentin).to_param
20
20
  assert_response :success
21
21
  end
22
-
22
+
23
23
  def test_should_delete_activity
24
24
  @request.env["HTTP_REFERER"] = '/'
25
-
25
+
26
26
  login_as :quentin
27
27
  users(:quentin).track_activity(:logged_in)
28
-
28
+
29
29
  assert_difference Activity, :count, -1 do
30
- delete :destroy, :id => Activity.last.id
30
+ delete :destroy, :id => Activity.last.id
31
31
  end
32
-
32
+
33
33
  assert_response :redirect
34
34
  end
35
-
35
+
36
36
  def test_should_not_delete_activity
37
37
  @request.env["HTTP_REFERER"] = '/'
38
-
38
+
39
39
  login_as :quentin
40
40
  users(:aaron).track_activity(:logged_in)
41
-
41
+
42
42
  assert_difference Activity, :count, 0 do
43
- delete :destroy, :id => Activity.last.id
43
+ delete :destroy, :id => Activity.last.id
44
44
  end
45
-
46
- assert_response :redirect
45
+
46
+ assert_response :redirect
47
47
  end
48
-
48
+
49
49
  def test_should_delete_activity_as_admin
50
50
  @request.env["HTTP_REFERER"] = '/'
51
-
51
+
52
52
  login_as :admin
53
53
  users(:quentin).track_activity(:logged_in)
54
-
54
+
55
55
  assert_difference Activity, :count, -1 do
56
- delete :destroy, :id => Activity.last.id
56
+ delete :destroy, :id => Activity.last.id
57
57
  end
58
-
59
- assert_response :redirect
58
+
59
+ assert_response :redirect
60
60
  end
61
61
 
62
62
  end
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ class AdminPostControllerTest < ActionController::TestCase
4
+ fixtures :all
5
+
6
+ setup do
7
+ @controller = ::Admin::PostsController.new
8
+ end
9
+
10
+ test 'should get index' do
11
+ login_as :admin
12
+ get :index
13
+ assert_response :success
14
+ end
15
+
16
+ end
@@ -1,82 +1,82 @@
1
- require 'test_helper'
2
-
3
- class AdminControllerTest < ActionController::TestCase
4
- fixtures :users, :categories, :roles
5
-
6
- def test_should_get_index
7
- login_as :admin
8
- get :users
9
- assert_response :success
10
- end
11
-
12
- def test_should_not_get_index
13
- login_as :quentin
14
- get :users
15
- assert_redirected_to login_path
16
- end
17
-
18
- def test_should_not_activate_user
19
- users(:quentin).update_attribute('activation_code', 'test')
20
- users(:quentin).update_attribute('activated_at', nil)
21
-
22
- login_as :quentin
23
- patch :activate_user, :id => users(:quentin).id
24
- assert !users(:quentin).active?
25
- assert_redirected_to login_path
26
- end
27
-
28
- def test_should_not_activate_user_js
29
- users(:quentin).update_attribute('activation_code', 'test')
30
- users(:quentin).update_attribute('activated_at', nil)
31
-
32
- get :activate_user, :id => users(:quentin).id, :format => 'js'
33
- assert !users(:quentin).active?
34
- end
35
-
36
-
37
- def test_should_activate_user
38
- users(:quentin).update_attribute('activation_code', 'test')
39
- users(:quentin).update_attribute('activated_at', nil)
40
-
41
- login_as :admin
42
- patch :activate_user, :id => users(:quentin).id
43
- assert_response :redirect
44
- assert users(:quentin).reload.active?
45
- end
46
-
47
- def test_should_deactivate_user
48
- login_as :admin
49
- patch :deactivate_user, :id => users(:quentin).id
50
- assert_response :redirect
51
- assert !users(:quentin).reload.active?
52
- end
53
-
54
- test "should list users" do
55
- login_as :admin
56
- get :users
57
- assert_response :success
58
- assert !assigns(:users).empty?
59
- end
60
-
61
- test "should search users" do
62
- login_as :admin
63
- get :users, :login => 'uenti'
64
- assert_response :success
65
- assert_equal assigns(:users).first, users(:quentin)
66
- end
67
-
68
- test "should clear cache" do
69
- login_as :admin
70
- get :clear_cache
71
- assert_redirected_to admin_dashboard_path
72
- end
73
-
74
- test "should get subscribers xml" do
75
- authorize_as :admin
76
-
77
- get :subscribers, :format => :xml
78
- assert_response :success
79
- assert assigns(:users).any?
80
- end
81
-
82
- end
1
+ # require 'test_helper'
2
+
3
+ # class AdminControllerTest < ActionController::TestCase
4
+ # fixtures :users, :categories, :roles
5
+
6
+ # def test_should_get_index
7
+ # login_as :admin
8
+ # get :users
9
+ # assert_response :success
10
+ # end
11
+
12
+ # def test_should_not_get_index
13
+ # login_as :quentin
14
+ # get :users
15
+ # assert_redirected_to login_path
16
+ # end
17
+
18
+ # def test_should_not_activate_user
19
+ # users(:quentin).update_attribute('activation_code', 'test')
20
+ # users(:quentin).update_attribute('activated_at', nil)
21
+
22
+ # login_as :quentin
23
+ # patch :activate_user, :id => users(:quentin).id
24
+ # assert !users(:quentin).active?
25
+ # assert_redirected_to login_path
26
+ # end
27
+
28
+ # def test_should_not_activate_user_js
29
+ # users(:quentin).update_attribute('activation_code', 'test')
30
+ # users(:quentin).update_attribute('activated_at', nil)
31
+
32
+ # get :activate_user, :id => users(:quentin).id, :format => 'js'
33
+ # assert !users(:quentin).active?
34
+ # end
35
+
36
+
37
+ # def test_should_activate_user
38
+ # users(:quentin).update_attribute('activation_code', 'test')
39
+ # users(:quentin).update_attribute('activated_at', nil)
40
+
41
+ # login_as :admin
42
+ # patch :activate_user, :id => users(:quentin).id
43
+ # assert_response :redirect
44
+ # assert users(:quentin).reload.active?
45
+ # end
46
+
47
+ # def test_should_deactivate_user
48
+ # login_as :admin
49
+ # patch :deactivate_user, :id => users(:quentin).id
50
+ # assert_response :redirect
51
+ # assert !users(:quentin).reload.active?
52
+ # end
53
+
54
+ # test "should list users" do
55
+ # login_as :admin
56
+ # get :users
57
+ # assert_response :success
58
+ # assert !assigns(:users).empty?
59
+ # end
60
+
61
+ # test "should search users" do
62
+ # login_as :admin
63
+ # get :users, :login => 'uenti'
64
+ # assert_response :success
65
+ # assert_equal assigns(:users).first, users(:quentin)
66
+ # end
67
+
68
+ # test "should clear cache" do
69
+ # login_as :admin
70
+ # get :clear_cache
71
+ # assert_redirected_to admin_dashboard_path
72
+ # end
73
+
74
+ # test "should get subscribers xml" do
75
+ # authorize_as :admin
76
+
77
+ # get :subscribers, :format => :xml
78
+ # assert_response :success
79
+ # assert assigns(:users).any?
80
+ # end
81
+
82
+ # end
@@ -3,49 +3,10 @@ require 'test_helper'
3
3
  class CategoriesControllerTest < ActionController::TestCase
4
4
  fixtures :categories, :users, :roles
5
5
 
6
- def test_should_get_index
7
- login_as :admin
8
- get :index
9
- assert_response :success
10
- assert assigns(:categories)
11
- end
12
-
13
- def test_should_get_new
14
- login_as :admin
15
- get :new
16
- assert_response :success
17
- end
18
-
19
- def test_should_create_category
20
- login_as :admin
21
- assert_difference Category, :count, 1 do
22
- post :create, :category => {:name => "Test Category"}
23
- end
24
- assert_redirected_to category_path(assigns(:category))
25
- end
26
6
 
27
7
  def test_should_show_category
28
8
  get :show, :id => categories(:how_to).id
29
9
  assert_response :success
30
10
  end
31
11
 
32
- def test_should_get_edit
33
- login_as :admin
34
- get :edit, :id => categories(:how_to).id
35
- assert_response :success
36
- end
37
-
38
- def test_should_update_category
39
- login_as :admin
40
- patch :update, :id => categories(:how_to).id, :category => { }
41
- assert_redirected_to category_path(assigns(:category))
42
- end
43
-
44
- def test_should_destroy_category
45
- login_as :admin
46
- assert_difference Category, :count, -1 do
47
- delete :destroy, :id => categories(:how_to).id
48
- end
49
- assert_redirected_to categories_path
50
- end
51
12
  end