annotate test/functional/calendars_controller_test.rb @ 36:de76cd3e8c8e cc-branches

* Probably abortive experiments in extracting the branch from Hg
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 20 Oct 2010 10:07:29 +0100
parents 1d32c0a0efbf
children 94944d00e43c
rev   line source
Chris@14 1 require File.dirname(__FILE__) + '/../test_helper'
Chris@0 2
Chris@0 3 class CalendarsControllerTest < ActionController::TestCase
Chris@0 4 fixtures :all
Chris@0 5
Chris@0 6 def test_calendar
Chris@0 7 get :show, :project_id => 1
Chris@0 8 assert_response :success
Chris@0 9 assert_template 'calendar'
Chris@0 10 assert_not_nil assigns(:calendar)
Chris@0 11 end
Chris@0 12
Chris@0 13 def test_cross_project_calendar
Chris@0 14 get :show
Chris@0 15 assert_response :success
Chris@0 16 assert_template 'calendar'
Chris@0 17 assert_not_nil assigns(:calendar)
Chris@0 18 end
Chris@0 19
Chris@0 20 def test_week_number_calculation
Chris@0 21 Setting.start_of_week = 7
Chris@0 22
Chris@0 23 get :show, :month => '1', :year => '2010'
Chris@0 24 assert_response :success
Chris@0 25
Chris@0 26 assert_tag :tag => 'tr',
Chris@0 27 :descendant => {:tag => 'td',
Chris@0 28 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 29 :descendant => {:tag => 'td',
Chris@0 30 :attributes => {:class => 'odd'}, :content => '27'},
Chris@0 31 :descendant => {:tag => 'td',
Chris@0 32 :attributes => {:class => 'even'}, :content => '2'}
Chris@0 33
Chris@0 34 assert_tag :tag => 'tr',
Chris@0 35 :descendant => {:tag => 'td',
Chris@0 36 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 37 :descendant => {:tag => 'td',
Chris@0 38 :attributes => {:class => 'odd'}, :content => '3'},
Chris@0 39 :descendant => {:tag => 'td',
Chris@0 40 :attributes => {:class => 'even'}, :content => '9'}
Chris@0 41
Chris@0 42
Chris@0 43 Setting.start_of_week = 1
Chris@0 44 get :show, :month => '1', :year => '2010'
Chris@0 45 assert_response :success
Chris@0 46
Chris@0 47 assert_tag :tag => 'tr',
Chris@0 48 :descendant => {:tag => 'td',
Chris@0 49 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 50 :descendant => {:tag => 'td',
Chris@0 51 :attributes => {:class => 'even'}, :content => '28'},
Chris@0 52 :descendant => {:tag => 'td',
Chris@0 53 :attributes => {:class => 'even'}, :content => '3'}
Chris@0 54
Chris@0 55 assert_tag :tag => 'tr',
Chris@0 56 :descendant => {:tag => 'td',
Chris@0 57 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 58 :descendant => {:tag => 'td',
Chris@0 59 :attributes => {:class => 'even'}, :content => '4'},
Chris@0 60 :descendant => {:tag => 'td',
Chris@0 61 :attributes => {:class => 'even'}, :content => '10'}
Chris@0 62
Chris@0 63 end
Chris@0 64 end