annotate .svn/pristine/9c/9c3af39547b04b7831f942c7b6b88179c7934a14.svn-base @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require File.expand_path('../../test_helper', __FILE__)
Chris@909 2
Chris@909 3 class CalendarsControllerTest < ActionController::TestCase
Chris@909 4 fixtures :projects,
Chris@909 5 :trackers,
Chris@909 6 :projects_trackers,
Chris@909 7 :roles,
Chris@909 8 :member_roles,
Chris@909 9 :members,
Chris@909 10 :auth_sources,
Chris@909 11 :enabled_modules
Chris@909 12
Chris@909 13 def test_calendar
Chris@909 14 get :show, :project_id => 1
Chris@909 15 assert_response :success
Chris@909 16 assert_template 'calendar'
Chris@909 17 assert_not_nil assigns(:calendar)
Chris@909 18 end
Chris@909 19
Chris@909 20 def test_cross_project_calendar
Chris@909 21 get :show
Chris@909 22 assert_response :success
Chris@909 23 assert_template 'calendar'
Chris@909 24 assert_not_nil assigns(:calendar)
Chris@909 25 end
Chris@909 26
Chris@909 27 context "GET :show" do
Chris@909 28 should "run custom queries" do
Chris@909 29 @query = Query.generate_default!(:is_public => true)
Chris@909 30
Chris@909 31 get :show, :query_id => @query.id
Chris@909 32 assert_response :success
Chris@909 33 end
Chris@909 34
Chris@909 35 end
Chris@909 36
Chris@909 37 def test_week_number_calculation
Chris@909 38 Setting.start_of_week = 7
Chris@909 39
Chris@909 40 get :show, :month => '1', :year => '2010'
Chris@909 41 assert_response :success
Chris@909 42
Chris@909 43 assert_tag :tag => 'tr',
Chris@909 44 :descendant => {:tag => 'td',
Chris@909 45 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@909 46 :descendant => {:tag => 'td',
Chris@909 47 :attributes => {:class => 'odd'}, :content => '27'},
Chris@909 48 :descendant => {:tag => 'td',
Chris@909 49 :attributes => {:class => 'even'}, :content => '2'}
Chris@909 50
Chris@909 51 assert_tag :tag => 'tr',
Chris@909 52 :descendant => {:tag => 'td',
Chris@909 53 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@909 54 :descendant => {:tag => 'td',
Chris@909 55 :attributes => {:class => 'odd'}, :content => '3'},
Chris@909 56 :descendant => {:tag => 'td',
Chris@909 57 :attributes => {:class => 'even'}, :content => '9'}
Chris@909 58
Chris@909 59
Chris@909 60 Setting.start_of_week = 1
Chris@909 61 get :show, :month => '1', :year => '2010'
Chris@909 62 assert_response :success
Chris@909 63
Chris@909 64 assert_tag :tag => 'tr',
Chris@909 65 :descendant => {:tag => 'td',
Chris@909 66 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@909 67 :descendant => {:tag => 'td',
Chris@909 68 :attributes => {:class => 'even'}, :content => '28'},
Chris@909 69 :descendant => {:tag => 'td',
Chris@909 70 :attributes => {:class => 'even'}, :content => '3'}
Chris@909 71
Chris@909 72 assert_tag :tag => 'tr',
Chris@909 73 :descendant => {:tag => 'td',
Chris@909 74 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@909 75 :descendant => {:tag => 'td',
Chris@909 76 :attributes => {:class => 'even'}, :content => '4'},
Chris@909 77 :descendant => {:tag => 'td',
Chris@909 78 :attributes => {:class => 'even'}, :content => '10'}
Chris@909 79
Chris@909 80 end
Chris@909 81 end