Mercurial > hg > soundsoftware-site
comparison test/functional/calendars_controller_test.rb @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 require 'test_helper' | |
2 | |
3 class CalendarsControllerTest < ActionController::TestCase | |
4 fixtures :all | |
5 | |
6 def test_calendar | |
7 get :show, :project_id => 1 | |
8 assert_response :success | |
9 assert_template 'calendar' | |
10 assert_not_nil assigns(:calendar) | |
11 end | |
12 | |
13 def test_cross_project_calendar | |
14 get :show | |
15 assert_response :success | |
16 assert_template 'calendar' | |
17 assert_not_nil assigns(:calendar) | |
18 end | |
19 | |
20 def test_week_number_calculation | |
21 Setting.start_of_week = 7 | |
22 | |
23 get :show, :month => '1', :year => '2010' | |
24 assert_response :success | |
25 | |
26 assert_tag :tag => 'tr', | |
27 :descendant => {:tag => 'td', | |
28 :attributes => {:class => 'week-number'}, :content => '53'}, | |
29 :descendant => {:tag => 'td', | |
30 :attributes => {:class => 'odd'}, :content => '27'}, | |
31 :descendant => {:tag => 'td', | |
32 :attributes => {:class => 'even'}, :content => '2'} | |
33 | |
34 assert_tag :tag => 'tr', | |
35 :descendant => {:tag => 'td', | |
36 :attributes => {:class => 'week-number'}, :content => '1'}, | |
37 :descendant => {:tag => 'td', | |
38 :attributes => {:class => 'odd'}, :content => '3'}, | |
39 :descendant => {:tag => 'td', | |
40 :attributes => {:class => 'even'}, :content => '9'} | |
41 | |
42 | |
43 Setting.start_of_week = 1 | |
44 get :show, :month => '1', :year => '2010' | |
45 assert_response :success | |
46 | |
47 assert_tag :tag => 'tr', | |
48 :descendant => {:tag => 'td', | |
49 :attributes => {:class => 'week-number'}, :content => '53'}, | |
50 :descendant => {:tag => 'td', | |
51 :attributes => {:class => 'even'}, :content => '28'}, | |
52 :descendant => {:tag => 'td', | |
53 :attributes => {:class => 'even'}, :content => '3'} | |
54 | |
55 assert_tag :tag => 'tr', | |
56 :descendant => {:tag => 'td', | |
57 :attributes => {:class => 'week-number'}, :content => '1'}, | |
58 :descendant => {:tag => 'td', | |
59 :attributes => {:class => 'even'}, :content => '4'}, | |
60 :descendant => {:tag => 'td', | |
61 :attributes => {:class => 'even'}, :content => '10'} | |
62 | |
63 end | |
64 end |