@@ -83,4 +83,71 class IssuesControllerTest < Test::Unit::TestCase | |||||
83 | assert_not_nil assigns(:changes) |
|
83 | assert_not_nil assigns(:changes) | |
84 | assert_equal 'application/atom+xml', @response.content_type |
|
84 | assert_equal 'application/atom+xml', @response.content_type | |
85 | end |
|
85 | end | |
|
86 | ||||
|
87 | def test_show | |||
|
88 | get :show, :id => 1 | |||
|
89 | assert_response :success | |||
|
90 | assert_template 'show.rhtml' | |||
|
91 | assert_not_nil assigns(:issue) | |||
|
92 | end | |||
|
93 | ||||
|
94 | def test_get_edit | |||
|
95 | @request.session[:user_id] = 2 | |||
|
96 | get :edit, :id => 1 | |||
|
97 | assert_response :success | |||
|
98 | assert_template 'edit' | |||
|
99 | assert_not_nil assigns(:issue) | |||
|
100 | assert_equal Issue.find(1), assigns(:issue) | |||
|
101 | end | |||
|
102 | ||||
|
103 | def test_post_edit | |||
|
104 | @request.session[:user_id] = 2 | |||
|
105 | post :edit, :id => 1, :issue => {:subject => 'Modified subject'} | |||
|
106 | assert_redirected_to 'issues/show/1' | |||
|
107 | assert_equal 'Modified subject', Issue.find(1).subject | |||
|
108 | end | |||
|
109 | ||||
|
110 | def test_post_change_status | |||
|
111 | issue = Issue.find(1) | |||
|
112 | assert_equal 1, issue.status_id | |||
|
113 | @request.session[:user_id] = 2 | |||
|
114 | post :change_status, :id => 1, | |||
|
115 | :new_status_id => 2, | |||
|
116 | :issue => { :assigned_to_id => 3 }, | |||
|
117 | :notes => 'Assigned to dlopper', | |||
|
118 | :confirm => 1 | |||
|
119 | assert_redirected_to 'issues/show/1' | |||
|
120 | issue.reload | |||
|
121 | assert_equal 2, issue.status_id | |||
|
122 | j = issue.journals.find(:first, :order => 'created_on DESC') | |||
|
123 | assert_equal 'Assigned to dlopper', j.notes | |||
|
124 | assert_equal 2, j.details.size | |||
|
125 | end | |||
|
126 | ||||
|
127 | def test_context_menu | |||
|
128 | @request.session[:user_id] = 2 | |||
|
129 | get :context_menu, :id => 1 | |||
|
130 | assert_response :success | |||
|
131 | assert_template 'context_menu' | |||
|
132 | end | |||
|
133 | ||||
|
134 | def test_destroy | |||
|
135 | @request.session[:user_id] = 2 | |||
|
136 | post :destroy, :id => 1 | |||
|
137 | assert_redirected_to 'projects/1/issues' | |||
|
138 | assert_nil Issue.find_by_id(1) | |||
|
139 | end | |||
|
140 | ||||
|
141 | def test_destroy_attachment | |||
|
142 | issue = Issue.find(3) | |||
|
143 | a = issue.attachments.size | |||
|
144 | @request.session[:user_id] = 2 | |||
|
145 | post :destroy_attachment, :id => 3, :attachment_id => 1 | |||
|
146 | assert_redirected_to 'issues/show/3' | |||
|
147 | assert_nil Attachment.find_by_id(1) | |||
|
148 | issue.reload | |||
|
149 | assert_equal((a-1), issue.attachments.size) | |||
|
150 | j = issue.journals.find(:first, :order => 'created_on DESC') | |||
|
151 | assert_equal 'attachment', j.details.first.property | |||
|
152 | end | |||
86 | end |
|
153 | end |
@@ -21,7 +21,7 class RepositoryBazaarTest < Test::Unit::TestCase | |||||
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path | |
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + 'tmp/test/bazaar_repository' |
|
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository' | |
25 |
|
25 | |||
26 | def setup |
|
26 | def setup | |
27 | @project = Project.find(1) |
|
27 | @project = Project.find(1) |
General Comments 0
You need to be logged in to leave comments.
Login now