annotate .svn/pristine/79/7947ff4a63ad5044882065fa3a909edb4224e94c.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

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