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
@@ -1,18 +0,0 @@
1
- - if @page.new_record?
2
- - url = admin_pages_path
3
- - else
4
- - url = admin_page_path(@page)
5
-
6
- = bootstrap_form_for @page, :url => url, :layout => :horizontal do |f|
7
- = f.text_field :title
8
- = f.text_area :body, :class => "rich_text_editor"
9
- = f.form_group :public do
10
- = f.check_box :page_public, :label => :make_page_public.l
11
- .help-block
12
- =:when_checked_this_page_will_be_visible_to_anyone.l
13
- =:when_unchecked_this_page_will_only_be_visible_to_people_who_are_logged_in_to.l
14
- =configatron.community_name
15
- = f.select :published_as, [[:published.l, 'live'], [:draft.l, 'draft']], :label => :save_page_as.l
16
-
17
- = f.form_group :submit_group do
18
- = f.primary :save.l
@@ -1,4 +0,0 @@
1
- -@page_title= :edit_page.l
2
-
3
- =render 'form'
4
-
@@ -1,34 +0,0 @@
1
- -@page_title=:manage_pages.l
2
-
3
- = render :partial => 'shared/admin_nav'
4
- -widget do
5
- %h3=:tips.l
6
- %p=:page_tips.l
7
-
8
- %p=:pages_saved_with_draft_status_wont_appear_on_the_site_until_you_publish_them.l
9
-
10
- %table.table.table-bordered.table-striped
11
- %tr
12
- %th=:title.l
13
- %th=:public.l
14
- %th=:status.l
15
- %th=:actions.l
16
- - @pages.each do |page|
17
- %tr
18
- %td
19
- = link_to page.title, edit_admin_page_path(page)
20
- %td
21
- -if page.is_public?
22
- = t(:yes)
23
- -else
24
- = t(:no)
25
- %td= page.is_live? ? link_to(:published.l, pages_path(page)) : :draft.l
26
- %td
27
- =link_to :show.l, pages_path(page), :class => 'btn btn-primary'
28
- - unless page.is_live?
29
- = link_to :preview.l, preview_admin_page_path(page), :class => 'btn btn-default'
30
- =link_to :edit.l, edit_admin_page_path(page), :class => 'btn btn-warning'
31
- =link_to :delete.l, pages_path(page), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger'
32
-
33
- =paginate @pages, :theme => 'bootstrap'
34
- =link_to :new_page.l, new_admin_page_path, :class => 'btn btn-success'
@@ -1,7 +0,0 @@
1
- -@page_title= :new_page.l
2
-
3
- %p
4
- =link_to :back.l, admin_pages_path, :class => 'btn btn-default'
5
-
6
- =render 'form'
7
-
@@ -1,17 +0,0 @@
1
- -widget do
2
- %h3=:admin.l
3
- %ul.list-unstyled
4
- %li= link_to_unless_current :features.l, homepage_features_path
5
- %li= link_to_unless_current :categories.l, categories_path
6
- %li= link_to_unless_current :metro_areas.l, metro_areas_path
7
- %li= link_to_unless_current :events.l, admin_events_path
8
- %li= link_to_unless_current :statistics.l, statistics_path
9
- %li= link_to_unless_current :ads.l, ads_path
10
- %li= link_to_unless_current :comments.l, admin_comments_path
11
- %li= link_to_unless_current :tags.l, admin_tags_path
12
- %li= link_to_unless_current :admin_pages.l, admin_pages_path
13
- %li= link_to_unless_current :users.l, admin_users_path
14
- - if @admin_nav_links.any?
15
- - @admin_nav_links.each do |link|
16
- %li=link_to link[:name], link[:url]
17
- %li= link_to :cache_clear_link.l, admin_clear_cache_path, data: { confirm: :are_you_sure.l }
@@ -1,15 +0,0 @@
1
- // Because the dom is loaded already we have to set up the tinymce config.
2
- $(".rich_text_editor").each(function(){
3
- var options = <%= @tiny_mce_configuration.to_json.html_safe %>;
4
- $this = $(this);
5
-
6
- // fix tinymce bug with html5 and required fields
7
- if($this.is("[required]")){
8
- options.oninit = function(editor){
9
- $this.closest("form").find(":submit").on("click", function(){
10
- editor.save();
11
- });
12
- }
13
- }
14
- $this.tinymce(options);
15
- });
@@ -1,33 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
- xml.rsp 'status_code' => 0, 'status_message' => 'Success' do
3
- xml.daily_counts 'type' => 'Logins' do
4
- current = (Time.now.midnight) - 8.days
5
- 0.upto 7 do |i|
6
- current += 1.day
7
- xml.count @logins[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
8
- end
9
- end
10
- xml.daily_counts 'type' => 'Comments' do
11
- current = (Time.now.midnight) - 8.days
12
- 0.upto 7 do |i|
13
- current += 1.day
14
- xml.count @comments[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
15
- end
16
- end
17
- xml.daily_counts 'type' => 'Posts' do
18
- current = (Time.now.midnight) - 8.days
19
- 0.upto 7 do |i|
20
- current += 1.day
21
- xml.count @posts[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
22
- end
23
- end
24
- xml.daily_counts 'type' => 'Photos' do
25
- current = (Time.now.midnight) - 8.days
26
- 0.upto 7 do |i|
27
- current += 1.day
28
- xml.count @photos[current.to_date.iso8601].to_i, 'date' => current.to_s(:line_grapher)
29
- end
30
- end
31
-
32
-
33
- end
@@ -1,48 +0,0 @@
1
- = render :partial => 'shared/admin_nav'
2
- -@page_title = :statistics.l
3
- %dl.dl-horizontal
4
- %dt= :total_users.l
5
- %dd= @total_users
6
- %dt= :unactivated_users.l
7
- %dd= @unactivated_users
8
- %dt= :new_today.l
9
- %dd
10
- = @today_new_users.size
11
- %ul
12
- - @today_new_users.each do |user|
13
- %li= link_to user.login, user_path(user)
14
-
15
- %dt= :new_yesterday.l
16
- %dd
17
- = @yesterday_new_users.size
18
- %ul
19
- - @yesterday_new_users.each do |user|
20
- %li= link_to user.login, user_path(user)
21
-
22
- %dt= :active.l
23
- %dd
24
- = pluralize @active_users_count, :user.l
25
- (
26
- = number_to_percentage((@active_users_count/@total_users.to_f)*100, :precision => 1)
27
- =", 1 "+:month.l+")"
28
- %dt= :most_active_1_month.l
29
- %dd
30
- ='Users'
31
- %ul
32
- - @active_users.each do |user|
33
- %li
34
- = link_to user.login, user_path(user.id)
35
- \(
36
- = user.activities_count
37
- \)
38
- %dt='Reporting ZIP'
39
- %dd= number_to_percentage @percent_reporting_zip, :precision => 1
40
- %dt=:male.l
41
- %dd= number_to_percentage @percent_male
42
- %dt=:female.l
43
- %dd= number_to_percentage @percent_female
44
- %dt= :featured_writer.l
45
- %dd
46
- %ul
47
- - @featured_writers.each do |w|
48
- %li= link_to w.login, statistics_user_path(w)
@@ -1,12 +0,0 @@
1
- -@page_title=:editing_tag.l
2
- = render :partial => 'shared/admin_nav'
3
-
4
- %p
5
- =link_to :back.l, admin_tags_path, :class => 'btn btn-default'
6
- =link_to :show.l, tag_path(@tag), :class => 'btn btn-primary'
7
- =link_to :delete.l, tag_path(@tag), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger'
8
-
9
- = bootstrap_form_for :tag, :url => tag_path(@tag), :layout => :horizontal, :html => {:method => 'put'} do |f|
10
- = f.text_field :name
11
- = f.form_group :submit_group do
12
- = f.primary :update.l
@@ -1,30 +0,0 @@
1
- -@page_title=:tags.l
2
- = render :partial => 'shared/admin_nav'
3
-
4
- -box do
5
- %h3=:search.l
6
- = bootstrap_form_for @search, :url => admin_tags_path, :layout => :horizontal do |f|
7
- = f.text_field :name_start, :label => :name.l
8
-
9
- = f.form_group :submit_group do
10
- = f.primary :search.l
11
-
12
- %table.table.table-bordered.table-striped
13
- %tr
14
- %th
15
- =sort_link @search, :name, :name.l
16
- %th
17
- =sort_link @search, :taggings_count, :taggings.l
18
- %th=:actions.l
19
-
20
- - for tag in @tags
21
- %tr
22
- %td= tag.name
23
- %td= tag.taggings.count
24
- %td
25
- = link_to :show.l, tag_path(tag), :class => 'btn btn-default'
26
- = link_to :edit.l, edit_tag_path(tag), :class => 'btn btn-warning'
27
- = link_to :destroy.l, tag_path(tag), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger'
28
-
29
- =paginate @tags, :theme => 'bootstrap'
30
-
@@ -1 +0,0 @@
1
- What does this do?
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AdsControllerTest < ActionController::TestCase
4
- fixtures :ads, :users, :categories, :roles
5
-
6
- def setup
7
- login_as :admin
8
- end
9
-
10
- def test_should_get_index
11
- get :index
12
- assert_response :success
13
- assert assigns(:ads)
14
- end
15
-
16
- def test_should_get_new
17
- get :new
18
- assert_response :success
19
- end
20
-
21
- def test_should_create_ad
22
- assert_difference Ad, :count do
23
- post :create, :ad => { :html => 'Our company is great!', :frequency => 1, :audience => 'all'}
24
- end
25
-
26
- assert_redirected_to ad_path(assigns(:ad))
27
- end
28
-
29
- def test_should_show_ad
30
- get :show, :id => ads(:hgtv).id
31
- assert_response :success
32
- end
33
-
34
- def test_should_get_edit
35
- get :edit, :id => ads(:hgtv).id
36
- assert_response :success
37
- end
38
-
39
- def test_should_update_ad
40
- patch :update, :id => ads(:hgtv).id, :ad => { }
41
- assert_redirected_to ad_path(assigns(:ad))
42
- end
43
-
44
- def test_should_destroy_ad
45
- assert_difference Ad, :count, -1 do
46
- delete :destroy, :id => ads(:hgtv).id
47
- end
48
-
49
- assert_redirected_to ads_path
50
- end
51
- end
@@ -1,69 +0,0 @@
1
- require 'test_helper'
2
-
3
- class HomepageFeaturesControllerTest < ActionController::TestCase
4
- fixtures :all
5
-
6
- def test_should_get_index
7
- login_as :admin
8
- get :index
9
- assert_response :success
10
- assert assigns(:homepage_features)
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_homepage_feature
20
- login_as :admin
21
- assert_difference HomepageFeature, :count, 1 do
22
- post :create, :homepage_feature => {:title => 'feature', :url => 'example.com', :image => fixture_file_upload('/files/library.jpg', 'image/jpg') }
23
- end
24
- assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
25
- end
26
-
27
- def test_should_fail_to_create_homepage_feature
28
- login_as :admin
29
- assert_no_difference HomepageFeature, :count do
30
- post :create, :homepage_feature => { }
31
- end
32
- assert_response :success
33
- end
34
-
35
-
36
- def test_should_show_homepage_feature
37
- login_as :admin
38
- get :show, :id => homepage_features(:community_tour).id
39
- assert_response :success
40
- end
41
-
42
- def test_should_get_edit
43
- login_as :admin
44
- get :edit, :id => homepage_features(:community_tour).id
45
- assert_response :success
46
- end
47
-
48
- def test_should_update_homepage_feature
49
- login_as :admin
50
- patch :update, :id => homepage_features(:community_tour).id, :homepage_feature => {:url => 'changed_url.com' }
51
- assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
52
- end
53
-
54
- def test_should_fail_to_update_homepage_feature
55
- login_as :admin
56
- patch :update, :id => homepage_features(:community_tour).id, :homepage_feature => { :url => nil }
57
- assert assigns(:homepage_feature).errors[:url]
58
- assert_response :success
59
- end
60
-
61
-
62
- def test_should_destroy_homepage_feature
63
- login_as :admin
64
- assert_difference HomepageFeature, :count, -1 do
65
- delete :destroy, :id => homepage_features(:community_tour).id
66
- end
67
- assert_redirected_to homepage_features_path
68
- end
69
- end
@@ -1,63 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MetroAreasControllerTest < ActionController::TestCase
4
- fixtures :metro_areas, :users, :countries, :roles
5
-
6
- def test_should_get_index
7
- login_as :admin
8
- get :index
9
- assert_response :success
10
- assert assigns(:metro_areas)
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_metro_area
20
- login_as :admin
21
- assert_difference MetroArea, :count, 1 do
22
- post :create, :metro_area => {:country_id => countries(:germany), :name => "Dusseldorf" }
23
- end
24
-
25
- assert_redirected_to metro_area_path(assigns(:metro_area))
26
- end
27
-
28
- def test_should_not_create_metro_area_without_country
29
- login_as :admin
30
- assert_no_difference MetroArea, :count do
31
- post :create, :metro_area => {:name => "Dusseldorf" }
32
- assert assigns(:metro_area).errors[:country_id]
33
- assert_response :success
34
- end
35
- end
36
-
37
- def test_should_show_metro_area
38
- login_as :admin
39
- get :show, :id => metro_areas(:twincities).id
40
- assert_response :success
41
- end
42
-
43
- def test_should_get_edit
44
- login_as :admin
45
- get :edit, :id => metro_areas(:twincities).id
46
- assert_response :success
47
- end
48
-
49
- def test_should_update_metro_area
50
- login_as :admin
51
- patch :update, :id => metro_areas(:twincities).id, :metro_area => { }
52
- assert_redirected_to metro_area_path(assigns(:metro_area))
53
- end
54
-
55
- def test_should_destroy_metro_area
56
- login_as :admin
57
- assert_difference MetroArea, :count, -1 do
58
- delete :destroy, :id => metro_areas(:twincities).id
59
- end
60
-
61
- assert_redirected_to metro_areas_path
62
- end
63
- end
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
-
3
- class StatisticsControllerTest < ActionController::TestCase
4
- fixtures :users, :roles
5
-
6
- def test_should_get_index
7
- login_as :admin
8
- get :index
9
- assert_response :success
10
- end
11
-
12
- def test_should_not_get_index
13
- login_as :quentin
14
- get :index
15
- assert_redirected_to login_url
16
- end
17
-
18
- end
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ActsAsTaggableOn::TagTest < ActiveSupport::TestCase
4
- fixtures :all
5
-
6
- test "should get popular tags" do
7
- popular = ActsAsTaggableOn::Tag.popular
8
- assert_equal popular.first['count'], 2
9
- end
10
-
11
- test "should get popular tags of one type" do
12
- popular = ActsAsTaggableOn::Tag.popular(20, 'clipping')
13
- assert_equal popular.to_a.size, 2
14
- assert_equal popular.first['count'], 2
15
- end
16
-
17
- test "should get related tags" do
18
- related = tags(:misc).related_tags
19
- assert_equal(related, [tags(:related_to_misc)])
20
- end
21
-
22
- end