annotate test/functional/calendars_controller_test.rb @ 1327:287f201c2802 redmine-2.2-integration

Add italic
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 20:56:22 +0100
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
Chris@0 2
Chris@0 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 :enabled_modules
Chris@0 11
Chris@0 12 def test_calendar
Chris@0 13 get :show, :project_id => 1
Chris@0 14 assert_response :success
Chris@0 15 assert_template 'calendar'
Chris@0 16 assert_not_nil assigns(:calendar)
Chris@0 17 end
Chris@909 18
Chris@0 19 def test_cross_project_calendar
Chris@0 20 get :show
Chris@0 21 assert_response :success
Chris@0 22 assert_template 'calendar'
Chris@0 23 assert_not_nil assigns(:calendar)
Chris@0 24 end
chris@37 25
chris@37 26 context "GET :show" do
chris@37 27 should "run custom queries" do
Chris@1115 28 @query = Query.create!(:name => 'Calendar', :is_public => true)
Chris@909 29
chris@37 30 get :show, :query_id => @query.id
chris@37 31 assert_response :success
chris@37 32 end
Chris@909 33
chris@37 34 end
Chris@909 35
Chris@0 36 def test_week_number_calculation
Chris@0 37 Setting.start_of_week = 7
Chris@909 38
Chris@0 39 get :show, :month => '1', :year => '2010'
Chris@0 40 assert_response :success
Chris@909 41
Chris@0 42 assert_tag :tag => 'tr',
Chris@0 43 :descendant => {:tag => 'td',
Chris@0 44 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 45 :descendant => {:tag => 'td',
Chris@0 46 :attributes => {:class => 'odd'}, :content => '27'},
Chris@0 47 :descendant => {:tag => 'td',
Chris@0 48 :attributes => {:class => 'even'}, :content => '2'}
Chris@0 49
Chris@0 50 assert_tag :tag => 'tr',
Chris@0 51 :descendant => {:tag => 'td',
Chris@0 52 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 53 :descendant => {:tag => 'td',
Chris@0 54 :attributes => {:class => 'odd'}, :content => '3'},
Chris@0 55 :descendant => {:tag => 'td',
Chris@0 56 :attributes => {:class => 'even'}, :content => '9'}
Chris@0 57
Chris@0 58
Chris@0 59 Setting.start_of_week = 1
Chris@0 60 get :show, :month => '1', :year => '2010'
Chris@0 61 assert_response :success
Chris@0 62
Chris@0 63 assert_tag :tag => 'tr',
Chris@0 64 :descendant => {:tag => 'td',
Chris@0 65 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 66 :descendant => {:tag => 'td',
Chris@0 67 :attributes => {:class => 'even'}, :content => '28'},
Chris@0 68 :descendant => {:tag => 'td',
Chris@0 69 :attributes => {:class => 'even'}, :content => '3'}
Chris@0 70
Chris@0 71 assert_tag :tag => 'tr',
Chris@0 72 :descendant => {:tag => 'td',
Chris@0 73 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 74 :descendant => {:tag => 'td',
Chris@0 75 :attributes => {:class => 'even'}, :content => '4'},
Chris@0 76 :descendant => {:tag => 'td',
Chris@0 77 :attributes => {:class => 'even'}, :content => '10'}
Chris@0 78
Chris@0 79 end
Chris@0 80 end