annotate test/functional/calendars_controller_test.rb @ 1470:2837ea054769 feature_550

Close obsolete branch feature_550
author Chris Cannam
date Tue, 22 Jan 2013 16:23:43 +0000
parents cbb26bc654de
children 433d4f72a19b
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 :auth_sources,
Chris@909 11 :enabled_modules
Chris@0 12
Chris@0 13 def test_calendar
Chris@0 14 get :show, :project_id => 1
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@909 19
Chris@0 20 def test_cross_project_calendar
Chris@0 21 get :show
Chris@0 22 assert_response :success
Chris@0 23 assert_template 'calendar'
Chris@0 24 assert_not_nil assigns(:calendar)
Chris@0 25 end
chris@37 26
chris@37 27 context "GET :show" do
chris@37 28 should "run custom queries" do
Chris@507 29 @query = Query.generate_default!(:is_public => true)
Chris@909 30
chris@37 31 get :show, :query_id => @query.id
chris@37 32 assert_response :success
chris@37 33 end
Chris@909 34
chris@37 35 end
Chris@909 36
Chris@0 37 def test_week_number_calculation
Chris@0 38 Setting.start_of_week = 7
Chris@909 39
Chris@0 40 get :show, :month => '1', :year => '2010'
Chris@0 41 assert_response :success
Chris@909 42
Chris@0 43 assert_tag :tag => 'tr',
Chris@0 44 :descendant => {:tag => 'td',
Chris@0 45 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 46 :descendant => {:tag => 'td',
Chris@0 47 :attributes => {:class => 'odd'}, :content => '27'},
Chris@0 48 :descendant => {:tag => 'td',
Chris@0 49 :attributes => {:class => 'even'}, :content => '2'}
Chris@0 50
Chris@0 51 assert_tag :tag => 'tr',
Chris@0 52 :descendant => {:tag => 'td',
Chris@0 53 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 54 :descendant => {:tag => 'td',
Chris@0 55 :attributes => {:class => 'odd'}, :content => '3'},
Chris@0 56 :descendant => {:tag => 'td',
Chris@0 57 :attributes => {:class => 'even'}, :content => '9'}
Chris@0 58
Chris@0 59
Chris@0 60 Setting.start_of_week = 1
Chris@0 61 get :show, :month => '1', :year => '2010'
Chris@0 62 assert_response :success
Chris@0 63
Chris@0 64 assert_tag :tag => 'tr',
Chris@0 65 :descendant => {:tag => 'td',
Chris@0 66 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 67 :descendant => {:tag => 'td',
Chris@0 68 :attributes => {:class => 'even'}, :content => '28'},
Chris@0 69 :descendant => {:tag => 'td',
Chris@0 70 :attributes => {:class => 'even'}, :content => '3'}
Chris@0 71
Chris@0 72 assert_tag :tag => 'tr',
Chris@0 73 :descendant => {:tag => 'td',
Chris@0 74 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 75 :descendant => {:tag => 'td',
Chris@0 76 :attributes => {:class => 'even'}, :content => '4'},
Chris@0 77 :descendant => {:tag => 'td',
Chris@0 78 :attributes => {:class => 'even'}, :content => '10'}
Chris@0 79
Chris@0 80 end
Chris@0 81 end