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