From 1c2bcef6de2d120327dd73bb4b2060562a6fcde7 Mon Sep 17 00:00:00 2001 From: Daniela Feitosa Date: Tue, 8 Apr 2014 16:12:09 -0300 Subject: [PATCH] Added pagination on events_by_day on profile agenda --- app/controllers/public/events_controller.rb | 2 +- test/functional/events_controller_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/public/events_controller.rb b/app/controllers/public/events_controller.rb index 0595d05..93a0e4d 100644 --- a/app/controllers/public/events_controller.rb +++ b/app/controllers/public/events_controller.rb @@ -21,7 +21,7 @@ class EventsController < PublicController def events_by_day @date = build_date(params[:year], params[:month], params[:day]) - @events = profile.events.by_day(@date) + @events = profile.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page]) render :partial => 'events' end diff --git a/test/functional/events_controller_test.rb b/test/functional/events_controller_test.rb index 57a5e30..1cd27fb 100644 --- a/test/functional/events_controller_test.rb +++ b/test/functional/events_controller_test.rb @@ -46,4 +46,12 @@ class EventsControllerTest < ActionController::TestCase assert_equal 20, assigns(:events).count end + should 'show events of specific day' do + profile.events << Event.new(:name => 'Joao Birthday', :start_date => Date.new(2009, 10, 28)) + + get :events_by_day, :profile => profile.identifier, :year => 2009, :month => 10, :day => 28 + + assert_tag :tag => 'a', :content => /Joao Birthday/ + end + end -- libgit2 0.21.2