##// END OF EJS Templates
fix test_global_index of functional activities controller test fails around UTC 00:00...
Toshi MARUYAMA -
r9688:6c6aae07a237
parent child
Show More
@@ -1,149 +1,152
1 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 3 class ActivitiesControllerTest < ActionController::TestCase
4 4 fixtures :projects, :trackers, :issue_statuses, :issues,
5 5 :enumerations, :users, :issue_categories,
6 6 :projects_trackers,
7 7 :roles,
8 8 :member_roles,
9 9 :members,
10 10 :groups_users,
11 11 :enabled_modules,
12 12 :workflows,
13 13 :journals, :journal_details
14 14
15 15
16 16 def test_project_index
17 17 get :index, :id => 1, :with_subprojects => 0
18 18 assert_response :success
19 19 assert_template 'index'
20 20 assert_not_nil assigns(:events_by_day)
21 21
22 22 assert_tag :tag => "h3",
23 23 :content => /#{2.days.ago.to_date.day}/,
24 24 :sibling => { :tag => "dl",
25 25 :child => { :tag => "dt",
26 26 :attributes => { :class => /issue-edit/ },
27 27 :child => { :tag => "a",
28 28 :content => /(#{IssueStatus.find(2).name})/,
29 29 }
30 30 }
31 31 }
32 32 end
33 33
34 34 def test_project_index_with_invalid_project_id_should_respond_404
35 35 get :index, :id => 299
36 36 assert_response 404
37 37 end
38 38
39 39 def test_previous_project_index
40 40 get :index, :id => 1, :from => 3.days.ago.to_date
41 41 assert_response :success
42 42 assert_template 'index'
43 43 assert_not_nil assigns(:events_by_day)
44 44
45 45 assert_tag :tag => "h3",
46 46 :content => /#{3.day.ago.to_date.day}/,
47 47 :sibling => { :tag => "dl",
48 48 :child => { :tag => "dt",
49 49 :attributes => { :class => /issue/ },
50 50 :child => { :tag => "a",
51 51 :content => /#{Issue.find(1).subject}/,
52 52 }
53 53 }
54 54 }
55 55 end
56 56
57 57 def test_global_index
58 @request.session[:user_id] = 1
58 59 get :index
59 60 assert_response :success
60 61 assert_template 'index'
61 62 assert_not_nil assigns(:events_by_day)
62 63
64 i5 = Issue.find(5)
65 d5 = User.find(1).time_to_date(i5.created_on)
63 66 assert_tag :tag => "h3",
64 :content => /#{5.day.ago.to_date.day}/,
67 :content => /#{d5.day}/,
65 68 :sibling => { :tag => "dl",
66 69 :child => { :tag => "dt",
67 70 :attributes => { :class => /issue/ },
68 71 :child => { :tag => "a",
69 72 :content => /#{Issue.find(5).subject}/,
70 73 }
71 74 }
72 75 }
73 76 end
74 77
75 78 def test_user_index
76 79 @request.session[:user_id] = 1
77 80 get :index, :user_id => 2
78 81 assert_response :success
79 82 assert_template 'index'
80 83 assert_not_nil assigns(:events_by_day)
81 84
82 85 assert_select 'h2 a[href=/users/2]', :text => 'John Smith'
83 86
84 87 i1 = Issue.find(1)
85 88 d1 = User.find(1).time_to_date(i1.created_on)
86 89
87 90 assert_tag :tag => "h3",
88 91 :content => /#{d1.day}/,
89 92 :sibling => { :tag => "dl",
90 93 :child => { :tag => "dt",
91 94 :attributes => { :class => /issue/ },
92 95 :child => { :tag => "a",
93 96 :content => /#{Issue.find(1).subject}/,
94 97 }
95 98 }
96 99 }
97 100 end
98 101
99 102 def test_user_index_with_invalid_user_id_should_respond_404
100 103 get :index, :user_id => 299
101 104 assert_response 404
102 105 end
103 106
104 107 def test_index_atom_feed
105 108 get :index, :format => 'atom', :with_subprojects => 0
106 109 assert_response :success
107 110 assert_template 'common/feed'
108 111
109 112 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
110 113 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'}
111 114 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
112 115 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'}
113 116
114 117 assert_tag :tag => 'entry', :child => {
115 118 :tag => 'link',
116 119 :attributes => {:href => 'http://test.host/issues/11'}}
117 120 end
118 121
119 122 def test_index_atom_feed_with_explicit_selection
120 123 get :index, :format => 'atom', :with_subprojects => 0,
121 124 :show_changesets => 1,
122 125 :show_documents => 1,
123 126 :show_files => 1,
124 127 :show_issues => 1,
125 128 :show_messages => 1,
126 129 :show_news => 1,
127 130 :show_time_entries => 1,
128 131 :show_wiki_edits => 1
129 132
130 133 assert_response :success
131 134 assert_template 'common/feed'
132 135
133 136 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
134 137 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'}
135 138 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
136 139 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'}
137 140
138 141 assert_tag :tag => 'entry', :child => {
139 142 :tag => 'link',
140 143 :attributes => {:href => 'http://test.host/issues/11'}}
141 144 end
142 145
143 146 def test_index_atom_feed_with_one_item_type
144 147 get :index, :format => 'atom', :show_issues => '1'
145 148 assert_response :success
146 149 assert_template 'common/feed'
147 150 assert_tag :tag => 'title', :content => /Issues/
148 151 end
149 152 end
General Comments 0
You need to be logged in to leave comments. Login now