リビジョン 1be3f3a2
| test/functional/term_categories_controller_test.rb | ||
|---|---|---|
|
|
||
|
class TermCategoriesControllerTest < ActionController::TestCase
|
||
|
fixtures :projects, :users, :roles, :members, :member_roles, :term_categories
|
||
|
plugin_fixtures :term_categories
|
||
|
plugin_fixtures :term_categories, :terms
|
||
|
|
||
|
def setup
|
||
|
@project = projects('projects_001')
|
||
| ... | ... | |
|
category = TermCategory.find(1)
|
||
|
assert_equal 2, category.position
|
||
|
end
|
||
|
|
||
|
def test_destroy_without_reassign
|
||
|
@request.session[:user_id] = users('users_002').id
|
||
|
post :destroy, params: { id: 1, project_id: 1 }
|
||
|
assert_raise(ActiveRecord::RecordNotFound) { TermCategory.find(1) }
|
||
|
assert_redirected_to controller: :term_categories, project_id: @project.identifier
|
||
|
end
|
||
|
|
||
|
def test_destroy_with_reassign
|
||
|
@request.session[:user_id] = users('users_002').id
|
||
|
post :destroy, params: { id: 2, project_id: 1, todo: 'reassign', reassign_to_id: 1 }
|
||
|
assert_equal 1, Term.find(2).category_id
|
||
|
assert_redirected_to controller: :term_categories, project_id: @project.identifier
|
||
|
end
|
||
|
end
|
||
Add functional test of destroy action for term_categories