To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / 18 / 1885ce921d043d16f90840164f06199bb85e23a9.svn-base @ 912:5e80956cc792

History | View | Annotate | Download (3.39 KB)

1
require File.expand_path('../../test_helper', __FILE__)
2

    
3
class ActivitiesControllerTest < ActionController::TestCase
4
  fixtures :projects, :trackers, :issue_statuses, :issues,
5
           :enumerations, :users, :issue_categories,
6
           :projects_trackers,
7
           :roles,
8
           :member_roles,
9
           :members,
10
           :groups_users,
11
           :enabled_modules,
12
           :workflows,
13
           :auth_sources,
14
           :journals, :journal_details
15

    
16

    
17
  def test_project_index
18
    get :index, :id => 1, :with_subprojects => 0
19
    assert_response :success
20
    assert_template 'index'
21
    assert_not_nil assigns(:events_by_day)
22

    
23
    assert_tag :tag => "h3",
24
               :content => /#{2.days.ago.to_date.day}/,
25
               :sibling => { :tag => "dl",
26
                 :child => { :tag => "dt",
27
                   :attributes => { :class => /issue-edit/ },
28
                   :child => { :tag => "a",
29
                     :content => /(#{IssueStatus.find(2).name})/,
30
                   }
31
                 }
32
               }
33
  end
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

    
40
  def test_previous_project_index
41
    get :index, :id => 1, :from => 3.days.ago.to_date
42
    assert_response :success
43
    assert_template 'index'
44
    assert_not_nil assigns(:events_by_day)
45

    
46
    assert_tag :tag => "h3",
47
               :content => /#{3.day.ago.to_date.day}/,
48
               :sibling => { :tag => "dl",
49
                 :child => { :tag => "dt",
50
                   :attributes => { :class => /issue/ },
51
                   :child => { :tag => "a",
52
                     :content => /#{Issue.find(1).subject}/,
53
                   }
54
                 }
55
               }
56
  end
57

    
58
  def test_global_index
59
    get :index
60
    assert_response :success
61
    assert_template 'index'
62
    assert_not_nil assigns(:events_by_day)
63

    
64
    assert_tag :tag => "h3",
65
               :content => /#{5.day.ago.to_date.day}/,
66
               :sibling => { :tag => "dl",
67
                 :child => { :tag => "dt",
68
                   :attributes => { :class => /issue/ },
69
                   :child => { :tag => "a",
70
                     :content => /#{Issue.find(5).subject}/,
71
                   }
72
                 }
73
               }
74
  end
75

    
76
  def test_user_index
77
    get :index, :user_id => 2
78
    assert_response :success
79
    assert_template 'index'
80
    assert_not_nil assigns(:events_by_day)
81

    
82
    assert_tag :tag => "h3",
83
               :content => /#{3.day.ago.to_date.day}/,
84
               :sibling => { :tag => "dl",
85
                 :child => { :tag => "dt",
86
                   :attributes => { :class => /issue/ },
87
                   :child => { :tag => "a",
88
                     :content => /#{Issue.find(1).subject}/,
89
                   }
90
                 }
91
               }
92
  end
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

    
99
  def test_index_atom_feed
100
    get :index, :format => 'atom'
101
    assert_response :success
102
    assert_template 'common/feed.atom'
103
    assert_tag :tag => 'entry', :child => {
104
      :tag => 'link',
105
      :attributes => {:href => 'http://test.host/issues/11'}}
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
114
end