Commit ff59cf7fe8a9e6bb47989bfcda908910688428ae

Authored by Rodrigo Souto
2 parents a9c0b239 fe3ebd1c

Merge branch 'stable' of https://gitlab.com/noosfero/noosfero into stable

app/controllers/public/events_controller.rb
... ... @@ -7,11 +7,11 @@ class EventsController < PublicController
7 7 @date = build_date(params[:year], params[:month], params[:day])
8 8  
9 9 if !params[:year] && !params[:month] && !params[:day]
10   - @events = profile.events.next_events_from_month(@date)
  10 + @events = profile.events.next_events_from_month(@date).paginate(:per_page => per_page, :page => params[:page])
11 11 end
12 12  
13 13 if params[:year] || params[:month]
14   - @events = profile.events.by_month(@date)
  14 + @events = profile.events.by_month(@date).paginate(:per_page => per_page, :page => params[:page])
15 15 end
16 16  
17 17 events_in_range = profile.events.by_range((@date - 1.month).at_beginning_of_month .. (@date + 1.month).at_end_of_month)
... ... @@ -29,4 +29,7 @@ class EventsController < PublicController
29 29  
30 30 include EventsHelper
31 31  
  32 + def per_page
  33 + 20
  34 + end
32 35 end
... ...
app/controllers/public/search_controller.rb
... ... @@ -99,14 +99,14 @@ class SearchController < PublicController
99 99 @events = []
100 100 if params[:day] || !params[:year] && !params[:month]
101 101 @events = @category ?
102   - environment.events.by_day(@date).in_category(Category.find(@category_id)) :
103   - environment.events.by_day(@date)
  102 + environment.events.by_day(@date).in_category(Category.find(@category_id)).paginate(:per_page => per_page, :page => params[:page]) :
  103 + environment.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page])
104 104 end
105 105  
106 106 if params[:year] || params[:month]
107 107 @events = @category ?
108   - environment.events.by_month(@date).in_category(Category.find(@category_id)) :
109   - environment.events.by_month(@date)
  108 + environment.events.by_month(@date).in_category(Category.find(@category_id)).paginate(:per_page => per_page, :page => params[:page]) :
  109 + environment.events.by_month(@date).paginate(:per_page => per_page, :page => params[:page])
110 110 end
111 111  
112 112 @scope = date_range && params[:action] == 'events' ? environment.events.by_range(date_range) : environment.events
... ... @@ -139,7 +139,7 @@ class SearchController < PublicController
139 139  
140 140 def events_by_day
141 141 @date = build_date(params[:year], params[:month], params[:day])
142   - @events = environment.events.by_day(@date)
  142 + @events = environment.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page])
143 143 render :partial => 'events/events'
144 144 end
145 145  
... ... @@ -224,4 +224,8 @@ class SearchController < PublicController
224 224 @environment.send(klass.name.underscore.pluralize).visible.includes(relations)
225 225 end
226 226  
  227 + def per_page
  228 + 20
  229 + end
  230 +
227 231 end
... ...
app/models/event.rb
... ... @@ -38,15 +38,12 @@ class Event < Article
38 38 named_scope :next_events_from_month, lambda { |date|
39 39 date_temp = date.strftime("%Y-%m-%d")
40 40 { :conditions => ["start_date >= ?","#{date_temp}"],
41   - :limit => 10,
42 41 :order => 'start_date ASC'
43 42 }
44 43 }
45 44  
46 45 named_scope :by_month, lambda { |date|
47   - date_temp = date.strftime("%Y-%m")
48 46 { :conditions => ["EXTRACT(YEAR FROM start_date) = ? AND EXTRACT(MONTH FROM start_date) = ?",date.year,date.month],
49   - :limit => 10,
50 47 :order => 'start_date ASC'
51 48 }
52 49 }
... ...
app/views/events/_events.rhtml
1   -<%= list_events(@date, @events) %>
2 1 \ No newline at end of file
  2 +<%= list_events(@date, @events) %>
  3 +
  4 +<%= pagination_links @events, :param_name => 'page' %>
... ...
features/events.feature
... ... @@ -244,3 +244,38 @@ Feature: events
244 244 Given I am on /profile/josesilva/events/2009/10
245 245 When I follow "Oktoberfest"
246 246 Then I should see "Oktoberfest"
  247 +
  248 + Scenario: list events paginated for a specific profile for the month
  249 + Given I am logged in as admin
  250 + And the following users
  251 + | login |
  252 + | josemanuel |
  253 + And I am logged in as "josemanuel"
  254 + And the following events
  255 + | owner | name | start_date |
  256 + | josemanuel | Event 5 | 2009-10-12 |
  257 + | josemanuel | Event 3 | 2009-10-15 |
  258 + | josemanuel | Test Event | 2009-10-15 |
  259 + | josemanuel | Oktoberfest | 2009-10-19 |
  260 + | josemanuel | WikiSym | 2009-10-21 |
  261 + | josemanuel | Free Software | 2009-10-22 |
  262 + | josemanuel | Rachel Birthday | 2009-10-23 |
  263 + | josemanuel | Manuel Birthday | 2009-10-24 |
  264 + | josemanuel | Michelle Birthday | 2009-10-25 |
  265 + | josemanuel | Lecture Allien 10 | 2009-10-26 |
  266 + | josemanuel | Lecture Allien 11 | 2009-10-26 |
  267 + | josemanuel | Lecture Allien 12 | 2009-10-26 |
  268 + | josemanuel | Lecture Allien 13 | 2009-10-26 |
  269 + | josemanuel | Lecture Allien 14 | 2009-10-26 |
  270 + | josemanuel | Lecture Allien 15 | 2009-10-26 |
  271 + | josemanuel | Lecture Allien 16 | 2009-10-26 |
  272 + | josemanuel | Lecture Allien 17 | 2009-10-26 |
  273 + | josemanuel | Lecture Allien 18 | 2009-10-26 |
  274 + | josemanuel | Lecture Allien 19 | 2009-10-26 |
  275 + | josemanuel | Lecture Allien 20 | 2009-10-26 |
  276 + | josemanuel | Party On | 2009-10-27 |
  277 +
  278 + When I am on /profile/josemanuel/events/2009/10
  279 + Then I should not see "Party On" within "#agenda-items"
  280 + When I follow "Next"
  281 + Then I should see "Party On" within "#agenda-items"
... ...
po/eo/noosfero.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: noosfero 0.45.2\n"
9 9 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
10   -"PO-Revision-Date: 2011-03-30 20:52-0300\n"
  10 +"PO-Revision-Date: 2014-03-25 15:35+0000\n"
11 11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 13 "Language: \n"
... ... @@ -107,7 +107,7 @@ msgstr &quot;&quot;
107 107 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25
108 108 #: app/views/profile/_private_profile.rhtml:10
109 109 msgid "Join"
110   -msgstr ""
  110 +msgstr "Eniri"
111 111  
112 112 #: app/helpers/application_helper.rb:554
113 113 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4
... ... @@ -291,7 +291,7 @@ msgstr &quot;&quot;
291 291  
292 292 #: app/helpers/application_helper.rb:1118
293 293 msgid "See all"
294   -msgstr ""
  294 +msgstr "Vidi ĉiujn"
295 295  
296 296 #: app/helpers/application_helper.rb:1121
297 297 msgid "<span>Manage</span> %s"
... ... @@ -678,11 +678,11 @@ msgstr &quot;&quot;
678 678  
679 679 #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23
680 680 msgid "&laquo; Newer posts"
681   -msgstr ""
  681 +msgstr "&laquo; Pli freŝaj afiŝoj"
682 682  
683 683 #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24
684 684 msgid "Older posts &raquo;"
685   -msgstr ""
  685 +msgstr "Malpli freŝaj afiŝoj &raquo"
686 686  
687 687 #: app/helpers/forum_helper.rb:18
688 688 msgid "Discussion topic"
... ... @@ -763,63 +763,63 @@ msgstr &quot;&quot;
763 763 #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172
764 764 #: plugins/display_content/lib/display_content_block.rb:4
765 765 msgid "January"
766   -msgstr ""
  766 +msgstr "Januaro"
767 767  
768 768 #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172
769 769 #: plugins/display_content/lib/display_content_block.rb:5
770 770 msgid "February"
771   -msgstr ""
  771 +msgstr "Februaro"
772 772  
773 773 #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172
774 774 #: plugins/display_content/lib/display_content_block.rb:6
775 775 msgid "March"
776   -msgstr ""
  776 +msgstr "Marto"
777 777  
778 778 #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172
779 779 #: plugins/display_content/lib/display_content_block.rb:7
780 780 msgid "April"
781   -msgstr ""
  781 +msgstr "Aprilo"
782 782  
783 783 #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172
784 784 #: app/helpers/forms_helper.rb:173
785 785 #: plugins/display_content/lib/display_content_block.rb:8
786 786 msgid "May"
787   -msgstr ""
  787 +msgstr "Majo"
788 788  
789 789 #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172
790 790 #: plugins/display_content/lib/display_content_block.rb:9
791 791 msgid "June"
792   -msgstr ""
  792 +msgstr "Junio"
793 793  
794 794 #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172
795 795 #: plugins/display_content/lib/display_content_block.rb:10
796 796 msgid "July"
797   -msgstr ""
  797 +msgstr "Julio"
798 798  
799 799 #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172
800 800 #: plugins/display_content/lib/display_content_block.rb:11
801 801 msgid "August"
802   -msgstr ""
  802 +msgstr "Aŭgusto"
803 803  
804 804 #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172
805 805 #: plugins/display_content/lib/display_content_block.rb:12
806 806 msgid "September"
807   -msgstr ""
  807 +msgstr "Septembro"
808 808  
809 809 #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172
810 810 #: plugins/display_content/lib/display_content_block.rb:13
811 811 msgid "October"
812   -msgstr ""
  812 +msgstr "Oktobro"
813 813  
814 814 #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172
815 815 #: plugins/display_content/lib/display_content_block.rb:14
816 816 msgid "November"
817   -msgstr ""
  817 +msgstr "Novembro"
818 818  
819 819 #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172
820 820 #: plugins/display_content/lib/display_content_block.rb:15
821 821 msgid "December"
822   -msgstr ""
  822 +msgstr "Decembro"
823 823  
824 824 #: app/helpers/dates_helper.rb:28
825 825 #: plugins/display_content/lib/display_content_block.rb:153
... ... @@ -834,7 +834,7 @@ msgstr &quot;&quot;
834 834 #: app/helpers/dates_helper.rb:31
835 835 #: plugins/display_content/lib/display_content_block.rb:156
836 836 msgid "%{month_name} %{day}, %{year}"
837   -msgstr ""
  837 +msgstr "La %{day}-a de %{month_name} %{year}"
838 838  
839 839 #: app/helpers/dates_helper.rb:31
840 840 #: plugins/display_content/lib/display_content_block.rb:156
... ... @@ -8043,7 +8043,7 @@ msgstr &quot;&quot;
8043 8043  
8044 8044 #: app/views/account/index_anonymous.rhtml:10
8045 8045 msgid "Sign up."
8046   -msgstr ""
  8046 +msgstr "Aliĝi"
8047 8047  
8048 8048 #: app/views/account/index_anonymous.rhtml:11
8049 8049 msgid ""
... ...
po/es/noosfero.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: noosfero 0.45.2\n"
9 9 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
10   -"PO-Revision-Date: 2013-01-03 18:39-0300\n"
  10 +"PO-Revision-Date: 2014-03-25 14:55+0000\n"
11 11 "Last-Translator: Luis David Aguilar Carlos <ludwig9003@gmail.com>,Freddy "
12 12 "Martín Hernández Facio <fmhf14@gmail.com>, Pedro Alonzo Ramírez Tovar <pedro."
13 13 "alonzo709@gmail.com>\n"
... ... @@ -292,7 +292,6 @@ msgid &quot;Next&quot;
292 292 msgstr "Siguiente"
293 293  
294 294 #: app/helpers/application_helper.rb:1118
295   -#, fuzzy
296 295 msgid "See all"
297 296 msgstr "Ver todos"
298 297  
... ... @@ -690,11 +689,11 @@ msgstr &quot;Configurar foro&quot;
690 689  
691 690 #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23
692 691 msgid "&laquo; Newer posts"
693   -msgstr "&laquo; Entradas recientes"
  692 +msgstr "&laquo; Noticias más nuevas"
694 693  
695 694 #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24
696 695 msgid "Older posts &raquo;"
697   -msgstr "Entradas antiguas &raquo;"
  696 +msgstr "Noticias más viejas &raquo;"
698 697  
699 698 #: app/helpers/forum_helper.rb:18
700 699 msgid "Discussion topic"
... ... @@ -841,15 +840,13 @@ msgstr &quot;%{day} de %{month} %{year}&quot;
841 840  
842 841 #: app/helpers/dates_helper.rb:28 app/helpers/dates_helper.rb:40
843 842 #: plugins/display_content/lib/display_content_block.rb:153
844   -#, fuzzy
845 843 msgid "%{month}/%{day}"
846   -msgstr "%{day} de %{month} %{year}"
  844 +msgstr "%{day}/%{month}"
847 845  
848 846 #: app/helpers/dates_helper.rb:31
849 847 #: plugins/display_content/lib/display_content_block.rb:156
850   -#, fuzzy
851 848 msgid "%{month_name} %{day}, %{year}"
852   -msgstr "%{day} de %{month} %{year}"
  849 +msgstr "%{day} de %{month} de %{year}"
853 850  
854 851 # LAs cadenas de este tipo NO se traducen
855 852 #: app/helpers/dates_helper.rb:31
... ... @@ -877,21 +874,19 @@ msgstr &quot;%{month} %{year}&quot;
877 874  
878 875 #: app/helpers/dates_helper.rb:53
879 876 msgid "%{day} %{month} %{year}, %{hour}:%{minutes}"
880   -msgstr "%{day} %{month} %{year}, %{hour}:%{minutes}"
  877 +msgstr "%{day} de %{month} de %{year}, %{hour}:%{minutes}"
881 878  
882 879 #: app/helpers/dates_helper.rb:65
883   -#, fuzzy
884 880 msgid "from %{month} %{day1} to %{day2}, %{year}"
885   -msgstr "%{day} de %{month} %{year}"
  881 +msgstr "de %{day1} para %{day2} de %{month} de %{year}"
886 882  
887 883 #: app/helpers/dates_helper.rb:72
888   -#, fuzzy
889 884 msgid "from %{date1} to %{date2}, %{year}"
890   -msgstr "Por %{author} el %{date}"
  885 +msgstr "de %{date1} para %{date2} de %{year}"
891 886  
892 887 #: app/helpers/dates_helper.rb:79
893 888 msgid "from %{date1} to %{date2}"
894   -msgstr "Por %{author} el %{date}"
  889 +msgstr "de %{date1} para %{date2}"
895 890  
896 891 #: app/helpers/dates_helper.rb:89 app/helpers/forms_helper.rb:163
897 892 msgid "Sun"
... ...
po/it/noosfero.po
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: noosfero 0.45.2\n"
10 10 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
11   -"PO-Revision-Date: 2012-06-05 10:27-0300\n"
  11 +"PO-Revision-Date: 2014-03-25 15:39+0000\n"
12 12 "Last-Translator: Daniela Feitosa <danielafeitosa@colivre.coop.br>\n"
13 13 "Language-Team: LANGUAGE TEAM <LL@li.org>\n"
14 14 "Language: \n"
... ... @@ -111,7 +111,7 @@ msgstr &quot;&quot;
111 111 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25
112 112 #: app/views/profile/_private_profile.rhtml:10
113 113 msgid "Join"
114   -msgstr ""
  114 +msgstr "Accedere"
115 115  
116 116 #: app/helpers/application_helper.rb:554
117 117 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4
... ... @@ -754,63 +754,63 @@ msgstr &quot;&quot;
754 754 #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172
755 755 #: plugins/display_content/lib/display_content_block.rb:4
756 756 msgid "January"
757   -msgstr ""
  757 +msgstr "gennaio"
758 758  
759 759 #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172
760 760 #: plugins/display_content/lib/display_content_block.rb:5
761 761 msgid "February"
762   -msgstr ""
  762 +msgstr "febbraio"
763 763  
764 764 #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172
765 765 #: plugins/display_content/lib/display_content_block.rb:6
766 766 msgid "March"
767   -msgstr ""
  767 +msgstr "marzo"
768 768  
769 769 #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172
770 770 #: plugins/display_content/lib/display_content_block.rb:7
771 771 msgid "April"
772   -msgstr ""
  772 +msgstr "aprile"
773 773  
774 774 #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172
775 775 #: app/helpers/forms_helper.rb:173
776 776 #: plugins/display_content/lib/display_content_block.rb:8
777 777 msgid "May"
778   -msgstr ""
  778 +msgstr "maggio"
779 779  
780 780 #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172
781 781 #: plugins/display_content/lib/display_content_block.rb:9
782 782 msgid "June"
783   -msgstr ""
  783 +msgstr "giugno"
784 784  
785 785 #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172
786 786 #: plugins/display_content/lib/display_content_block.rb:10
787 787 msgid "July"
788   -msgstr ""
  788 +msgstr "luglio"
789 789  
790 790 #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172
791 791 #: plugins/display_content/lib/display_content_block.rb:11
792 792 msgid "August"
793   -msgstr ""
  793 +msgstr "agosto"
794 794  
795 795 #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172
796 796 #: plugins/display_content/lib/display_content_block.rb:12
797 797 msgid "September"
798   -msgstr ""
  798 +msgstr "settembre"
799 799  
800 800 #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172
801 801 #: plugins/display_content/lib/display_content_block.rb:13
802 802 msgid "October"
803   -msgstr ""
  803 +msgstr "ottobre"
804 804  
805 805 #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172
806 806 #: plugins/display_content/lib/display_content_block.rb:14
807 807 msgid "November"
808   -msgstr ""
  808 +msgstr "novembre"
809 809  
810 810 #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172
811 811 #: plugins/display_content/lib/display_content_block.rb:15
812 812 msgid "December"
813   -msgstr ""
  813 +msgstr "dicembre"
814 814  
815 815 #: app/helpers/dates_helper.rb:28
816 816 #: plugins/display_content/lib/display_content_block.rb:153
... ... @@ -825,7 +825,7 @@ msgstr &quot;&quot;
825 825 #: app/helpers/dates_helper.rb:31
826 826 #: plugins/display_content/lib/display_content_block.rb:156
827 827 msgid "%{month_name} %{day}, %{year}"
828   -msgstr ""
  828 +msgstr "%{day} %{month_name} %{year}"
829 829  
830 830 #: app/helpers/dates_helper.rb:31
831 831 #: plugins/display_content/lib/display_content_block.rb:156
... ... @@ -8018,7 +8018,7 @@ msgstr &quot;&quot;
8018 8018  
8019 8019 #: app/views/account/index_anonymous.rhtml:10
8020 8020 msgid "Sign up."
8021   -msgstr ""
  8021 +msgstr "Registro"
8022 8022  
8023 8023 #: app/views/account/index_anonymous.rhtml:11
8024 8024 msgid ""
... ...
public/stylesheets/application.css
... ... @@ -3578,9 +3578,10 @@ div#article-parent {
3578 3578 }
3579 3579 #agenda .agenda-calendar {
3580 3580 width: 50%;
  3581 + display: inline-block;
3581 3582 }
3582 3583 #agenda td, #agenda th {
3583   - padding: 15px;
  3584 + padding: 10px;
3584 3585 padding-right: 0px;
3585 3586 }
3586 3587 #agenda .agenda-calendar .previous-month td, #agenda .agenda-calendar .previous-month th, #agenda .agenda-calendar .next-month td, #agenda .agenda-calendar .next-month th {
... ... @@ -3638,26 +3639,25 @@ div#article-parent {
3638 3639 vertical-align: middle;
3639 3640 }
3640 3641 #agenda .agenda-calendar .current-month caption {
3641   - margin-bottom: 10px;
  3642 + margin: 10px 0px;
3642 3643 }
3643 3644 #agenda #events-of-the-day {
3644   - position: absolute;
3645   - left: 50%;
3646 3645 width: 45%;
3647   - top: 0px;
3648 3646 height: 100%;
3649 3647 padding-left: 20px;
  3648 + display: inline-block;
  3649 + vertical-align: top;
3650 3650 }
3651 3651 #agenda #events-of-the-day #agenda-items {
3652 3652 display: block;
3653 3653 overflow: auto;
3654 3654 overflow-x: hidden;
3655   - height: 80%;
  3655 + height: 250px;
3656 3656 background: white;
3657 3657 border: none;
3658 3658 }
3659 3659 #agenda-toolbar {
3660   - float: right;
  3660 + text-align: right;
3661 3661 font-variant: normal;
3662 3662 font-weight: normal;
3663 3663 }
... ... @@ -3680,6 +3680,9 @@ h1#agenda-title {
3680 3680 display: block;
3681 3681 margin-top: 10px;
3682 3682 }
  3683 +#agenda .pagination {
  3684 + margin-top: 15px;
  3685 +}
3683 3686 /* ==> public/stylesheets/controller_favorite_enterprises.css <== */
3684 3687  
3685 3688 /* ==> @import url(manage_contacts_list.css); <== */
... ...
test/functional/events_controller_test.rb
... ... @@ -38,4 +38,12 @@ class EventsControllerTest &lt; ActionController::TestCase
38 38 assert_tag :tag =>'a', :attributes => {:href => "/profile/#{profile.identifier}/events/#{next_month.year}/#{next_month.month}"}, :content => next_month_name
39 39 end
40 40  
  41 + should 'see the events paginated' do
  42 + 30.times do |i|
  43 + profile.events << Event.new(:name => "Lesson #{i}", :start_date => Date.today)
  44 + end
  45 + get :events, :profile => profile.identifier
  46 + assert_equal 20, assigns(:events).count
  47 + end
  48 +
41 49 end
... ...
test/functional/search_controller_test.rb
... ... @@ -370,6 +370,14 @@ class SearchControllerTest &lt; ActionController::TestCase
370 370 assert_equal [ 'upcoming event 1' ], assigns(:searches)[:events][:results].map(&:name)
371 371 end
372 372  
  373 + should 'see the events paginated' do
  374 + 30.times do |i|
  375 + create_event(person, :name => "Event #{i}", :start_date => Date.today)
  376 + end
  377 + get :events
  378 + assert_equal 20, assigns(:events).count
  379 + end
  380 +
373 381 %w[ people enterprises articles events communities products ].each do |asset|
374 382 should "render asset-specific template when searching for #{asset}" do
375 383 get "#{asset}"
... ...