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