##// END OF EJS Templates
Adds functional tests for ActivitiesController....
Jean-Philippe Lang -
r7866:dd501b1ba30a
parent child
Show More
@@ -1,97 +1,114
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 :auth_sources,
14 14 :journals, :journal_details
15 15
16 16
17 17 def test_project_index
18 18 get :index, :id => 1, :with_subprojects => 0
19 19 assert_response :success
20 20 assert_template 'index'
21 21 assert_not_nil assigns(:events_by_day)
22 22
23 23 assert_tag :tag => "h3",
24 24 :content => /#{2.days.ago.to_date.day}/,
25 25 :sibling => { :tag => "dl",
26 26 :child => { :tag => "dt",
27 27 :attributes => { :class => /issue-edit/ },
28 28 :child => { :tag => "a",
29 29 :content => /(#{IssueStatus.find(2).name})/,
30 30 }
31 31 }
32 32 }
33 33 end
34 34
35 def test_project_index_with_invalid_project_id_should_respond_404
36 get :index, :id => 299
37 assert_response 404
38 end
39
35 40 def test_previous_project_index
36 41 get :index, :id => 1, :from => 3.days.ago.to_date
37 42 assert_response :success
38 43 assert_template 'index'
39 44 assert_not_nil assigns(:events_by_day)
40 45
41 46 assert_tag :tag => "h3",
42 47 :content => /#{3.day.ago.to_date.day}/,
43 48 :sibling => { :tag => "dl",
44 49 :child => { :tag => "dt",
45 50 :attributes => { :class => /issue/ },
46 51 :child => { :tag => "a",
47 52 :content => /#{Issue.find(1).subject}/,
48 53 }
49 54 }
50 55 }
51 56 end
52 57
53 58 def test_global_index
54 59 get :index
55 60 assert_response :success
56 61 assert_template 'index'
57 62 assert_not_nil assigns(:events_by_day)
58 63
59 64 assert_tag :tag => "h3",
60 65 :content => /#{5.day.ago.to_date.day}/,
61 66 :sibling => { :tag => "dl",
62 67 :child => { :tag => "dt",
63 68 :attributes => { :class => /issue/ },
64 69 :child => { :tag => "a",
65 70 :content => /#{Issue.find(5).subject}/,
66 71 }
67 72 }
68 73 }
69 74 end
70 75
71 76 def test_user_index
72 77 get :index, :user_id => 2
73 78 assert_response :success
74 79 assert_template 'index'
75 80 assert_not_nil assigns(:events_by_day)
76 81
77 82 assert_tag :tag => "h3",
78 83 :content => /#{3.day.ago.to_date.day}/,
79 84 :sibling => { :tag => "dl",
80 85 :child => { :tag => "dt",
81 86 :attributes => { :class => /issue/ },
82 87 :child => { :tag => "a",
83 88 :content => /#{Issue.find(1).subject}/,
84 89 }
85 90 }
86 91 }
87 92 end
88 93
94 def test_user_index_with_invalid_user_id_should_respond_404
95 get :index, :user_id => 299
96 assert_response 404
97 end
98
89 99 def test_index_atom_feed
90 100 get :index, :format => 'atom'
91 101 assert_response :success
92 102 assert_template 'common/feed.atom'
93 103 assert_tag :tag => 'entry', :child => {
94 104 :tag => 'link',
95 105 :attributes => {:href => 'http://test.host/issues/11'}}
96 106 end
107
108 def test_index_atom_feed_with_one_item_type
109 get :index, :format => 'atom', :show_issues => '1'
110 assert_response :success
111 assert_template 'common/feed.atom'
112 assert_tag :tag => 'title', :content => /Issues/
113 end
97 114 end
General Comments 0
You need to be logged in to leave comments. Login now