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