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