@@ -220,6 +220,7 class AttachmentsControllerTest < ActionController::TestCase | |||
|
220 | 220 | end |
|
221 | 221 | |
|
222 | 222 | def test_destroy_issue_attachment |
|
223 | set_tmp_attachments_directory | |
|
223 | 224 | issue = Issue.find(3) |
|
224 | 225 | @request.session[:user_id] = 2 |
|
225 | 226 | |
@@ -233,42 +234,41 class AttachmentsControllerTest < ActionController::TestCase | |||
|
233 | 234 | assert_equal 'attachment', j.details.first.property |
|
234 | 235 | assert_equal '1', j.details.first.prop_key |
|
235 | 236 | assert_equal 'error281.txt', j.details.first.old_value |
|
236 | set_tmp_attachments_directory | |
|
237 | 237 | end |
|
238 | 238 | |
|
239 | 239 | def test_destroy_wiki_page_attachment |
|
240 | set_tmp_attachments_directory | |
|
240 | 241 | @request.session[:user_id] = 2 |
|
241 | 242 | assert_difference 'Attachment.count', -1 do |
|
242 | 243 | delete :destroy, :id => 3 |
|
243 | 244 | assert_response 302 |
|
244 | 245 | end |
|
245 | set_tmp_attachments_directory | |
|
246 | 246 | end |
|
247 | 247 | |
|
248 | 248 | def test_destroy_project_attachment |
|
249 | set_tmp_attachments_directory | |
|
249 | 250 | @request.session[:user_id] = 2 |
|
250 | 251 | assert_difference 'Attachment.count', -1 do |
|
251 | 252 | delete :destroy, :id => 8 |
|
252 | 253 | assert_response 302 |
|
253 | 254 | end |
|
254 | set_tmp_attachments_directory | |
|
255 | 255 | end |
|
256 | 256 | |
|
257 | 257 | def test_destroy_version_attachment |
|
258 | set_tmp_attachments_directory | |
|
258 | 259 | @request.session[:user_id] = 2 |
|
259 | 260 | assert_difference 'Attachment.count', -1 do |
|
260 | 261 | delete :destroy, :id => 9 |
|
261 | 262 | assert_response 302 |
|
262 | 263 | end |
|
263 | set_tmp_attachments_directory | |
|
264 | 264 | end |
|
265 | 265 | |
|
266 | 266 | def test_destroy_without_permission |
|
267 | set_tmp_attachments_directory | |
|
267 | 268 | assert_no_difference 'Attachment.count' do |
|
268 | 269 | delete :destroy, :id => 3 |
|
269 | 270 | end |
|
270 | 271 | assert_response 302 |
|
271 | 272 | assert Attachment.find_by_id(3) |
|
272 | set_tmp_attachments_directory | |
|
273 | 273 | end |
|
274 | 274 | end |
General Comments 0
You need to be logged in to leave comments.
Login now