comparison .svn/pristine/79/7947ff4a63ad5044882065fa3a909edb4224e94c.svn-base @ 1295:622f24f53b42 redmine-2.3

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