Defect #33116 ยป 33116.patch
| app/controllers/documents_controller.rb | ||
|---|---|---|
|
def destroy
|
||
|
@document.destroy if request.delete?
|
||
|
flash[:notice] = l(:notice_successful_delete)
|
||
|
redirect_to project_documents_path(@project)
|
||
|
end
|
||
| app/controllers/issues_controller.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
respond_to do |format|
|
||
|
format.html {redirect_back_or_default _project_issues_path(@project)}
|
||
|
format.html {
|
||
|
flash[:notice] = l(:notice_successful_delete)
|
||
|
redirect_back_or_default _project_issues_path(@project)
|
||
|
}
|
||
|
format.api {render_api_ok}
|
||
|
end
|
||
|
end
|
||
| app/controllers/news_controller.rb | ||
|---|---|---|
|
def destroy
|
||
|
@news.destroy
|
||
|
respond_to do |format|
|
||
|
format.html { redirect_to project_news_index_path(@project) }
|
||
|
format.html {
|
||
|
flash[:notice] = l(:notice_successful_delete)
|
||
|
redirect_to project_news_index_path(@project)
|
||
|
}
|
||
|
format.api { render_api_ok }
|
||
|
end
|
||
|
end
|
||
| app/controllers/wiki_controller.rb | ||
|---|---|---|
|
end
|
||
|
@page.destroy
|
||
|
respond_to do |format|
|
||
|
format.html { redirect_to project_wiki_index_path(@project) }
|
||
|
format.html {
|
||
|
flash[:notice] = l(:notice_successful_delete)
|
||
|
redirect_to project_wiki_index_path(@project)
|
||
|
}
|
||
|
format.api { render_api_ok }
|
||
|
end
|
||
|
end
|
||
| test/functional/documents_controller_test.rb | ||
|---|---|---|
|
}
|
||
|
end
|
||
|
assert_redirected_to '/projects/ecookbook/documents'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil Document.find_by_id(1)
|
||
|
end
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
delete(:destroy, :params => {:id => 2})
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil Issue.find_by_id(2)
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||
|
assert_nil TimeEntry.find_by_id([1, 2])
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||
|
assert_nil TimeEntry.find(1).issue_id
|
||
|
assert_nil TimeEntry.find(2).issue_id
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
|
||
|
assert_equal 2, TimeEntry.find(1).issue_id
|
||
|
assert_equal 2, TimeEntry.find(2).issue_id
|
||
| ... | ... | |
|
}
|
||
|
)
|
||
|
assert_response 302
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
end
|
||
|
end
|
||
|
assert_equal 3, target.time_entries.count
|
||
| ... | ... | |
|
)
|
||
|
end
|
||
|
assert_redirected_to :controller => 'issues', :action => 'index'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6))
|
||
|
end
|
||
| ... | ... | |
|
)
|
||
|
end
|
||
|
assert_response 302
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
end
|
||
|
def test_destroy_invalid_should_respond_with_404
|
||
| ... | ... | |
|
delete(:destroy, :params => {:id => issue.id})
|
||
|
end
|
||
|
assert_response 302
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
end
|
||
|
def test_destroy_without_permission_on_tracker_should_be_denied
|
||
| test/functional/news_controller_test.rb | ||
|---|---|---|
|
@request.session[:user_id] = 2
|
||
|
delete(:destroy, :params => {:id => 1})
|
||
|
assert_redirected_to '/projects/ecookbook/news'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil News.find_by_id(1)
|
||
|
end
|
||
|
end
|
||
| test/functional/wiki_controller_test.rb | ||
|---|---|---|
|
@request.session[:user_id] = 2
|
||
|
delete :destroy, :params => {:project_id => 1, :id => 'Child_2'}
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
end
|
||
|
def test_destroy_parent_should_ask_confirmation
|
||
| ... | ... | |
|
delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'nullify'}
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil WikiPage.find_by_id(2)
|
||
|
end
|
||
| ... | ... | |
|
delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'destroy'}
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil WikiPage.find_by_id(2)
|
||
|
assert_nil WikiPage.find_by_id(5)
|
||
|
end
|
||
| ... | ... | |
|
delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1}
|
||
|
end
|
||
|
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
||
|
assert_equal 'Successful deletion.', flash[:notice]
|
||
|
assert_nil WikiPage.find_by_id(2)
|
||
|
assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
|
||
|
end
|
||