Chris@119
|
1 require File.expand_path('../../test_helper', __FILE__)
|
chris@22
|
2
|
chris@22
|
3 class ActivitiesControllerTest < ActionController::TestCase
|
chris@22
|
4 fixtures :all
|
chris@22
|
5
|
chris@22
|
6 def test_project_index
|
chris@22
|
7 get :index, :id => 1, :with_subprojects => 0
|
chris@22
|
8 assert_response :success
|
chris@22
|
9 assert_template 'index'
|
chris@22
|
10 assert_not_nil assigns(:events_by_day)
|
Chris@441
|
11
|
Chris@441
|
12 assert_tag :tag => "h3",
|
chris@22
|
13 :content => /#{2.days.ago.to_date.day}/,
|
chris@22
|
14 :sibling => { :tag => "dl",
|
chris@22
|
15 :child => { :tag => "dt",
|
chris@22
|
16 :attributes => { :class => /issue-edit/ },
|
chris@22
|
17 :child => { :tag => "a",
|
chris@22
|
18 :content => /(#{IssueStatus.find(2).name})/,
|
chris@22
|
19 }
|
chris@22
|
20 }
|
chris@22
|
21 }
|
chris@22
|
22 end
|
Chris@441
|
23
|
chris@22
|
24 def test_previous_project_index
|
chris@22
|
25 get :index, :id => 1, :from => 3.days.ago.to_date
|
chris@22
|
26 assert_response :success
|
chris@22
|
27 assert_template 'index'
|
chris@22
|
28 assert_not_nil assigns(:events_by_day)
|
Chris@441
|
29
|
Chris@441
|
30 assert_tag :tag => "h3",
|
chris@22
|
31 :content => /#{3.day.ago.to_date.day}/,
|
chris@22
|
32 :sibling => { :tag => "dl",
|
chris@22
|
33 :child => { :tag => "dt",
|
chris@22
|
34 :attributes => { :class => /issue/ },
|
chris@22
|
35 :child => { :tag => "a",
|
chris@22
|
36 :content => /#{Issue.find(1).subject}/,
|
chris@22
|
37 }
|
chris@22
|
38 }
|
chris@22
|
39 }
|
chris@22
|
40 end
|
Chris@441
|
41
|
chris@22
|
42 def test_global_index
|
chris@22
|
43 get :index
|
chris@22
|
44 assert_response :success
|
chris@22
|
45 assert_template 'index'
|
chris@22
|
46 assert_not_nil assigns(:events_by_day)
|
Chris@441
|
47
|
Chris@441
|
48 assert_tag :tag => "h3",
|
chris@22
|
49 :content => /#{5.day.ago.to_date.day}/,
|
chris@22
|
50 :sibling => { :tag => "dl",
|
chris@22
|
51 :child => { :tag => "dt",
|
chris@22
|
52 :attributes => { :class => /issue/ },
|
chris@22
|
53 :child => { :tag => "a",
|
chris@22
|
54 :content => /#{Issue.find(5).subject}/,
|
chris@22
|
55 }
|
chris@22
|
56 }
|
chris@22
|
57 }
|
chris@22
|
58 end
|
Chris@441
|
59
|
chris@22
|
60 def test_user_index
|
chris@22
|
61 get :index, :user_id => 2
|
chris@22
|
62 assert_response :success
|
chris@22
|
63 assert_template 'index'
|
chris@22
|
64 assert_not_nil assigns(:events_by_day)
|
Chris@441
|
65
|
Chris@441
|
66 assert_tag :tag => "h3",
|
chris@22
|
67 :content => /#{3.day.ago.to_date.day}/,
|
chris@22
|
68 :sibling => { :tag => "dl",
|
chris@22
|
69 :child => { :tag => "dt",
|
chris@22
|
70 :attributes => { :class => /issue/ },
|
chris@22
|
71 :child => { :tag => "a",
|
chris@22
|
72 :content => /#{Issue.find(1).subject}/,
|
chris@22
|
73 }
|
chris@22
|
74 }
|
chris@22
|
75 }
|
chris@22
|
76 end
|
Chris@441
|
77
|
chris@22
|
78 def test_index_atom_feed
|
chris@22
|
79 get :index, :format => 'atom'
|
chris@22
|
80 assert_response :success
|
chris@22
|
81 assert_template 'common/feed.atom.rxml'
|
chris@22
|
82 assert_tag :tag => 'entry', :child => {
|
chris@22
|
83 :tag => 'link',
|
chris@22
|
84 :attributes => {:href => 'http://test.host/issues/11'}}
|
chris@22
|
85 end
|
chris@22
|
86 end
|