[phase-18]Add edit/update action test for GlossaryCategoriesController

This commit is contained in:
Toru Takahashi 2018-08-09 23:46:52 +09:00 committed by TAKAHASHI,Toru
parent 8e856ce4a4
commit b9f410b0f6

View File

@ -2,7 +2,8 @@ require File.expand_path('../../test_helper', __FILE__)
class GlossaryCategoriesControllerTest < ActionController::TestCase class GlossaryCategoriesControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles, :members, :member_roles fixtures :projects, :users, :roles, :members, :member_roles
plugin_fixtures :glossary_categories
def setup def setup
@project = projects('projects_001') @project = projects('projects_001')
@project.enabled_module_names = [:glossary] @project.enabled_module_names = [:glossary]
@ -14,4 +15,19 @@ class GlossaryCategoriesControllerTest < ActionController::TestCase
get :index, params: {project_id: 1} get :index, params: {project_id: 1}
assert_response :success assert_response :success
end end
def test_edit
@request.session[:user_id] = users('users_002').id
get :edit, params: {id: 1, project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_update
@request.session[:user_id] = users('users_002').id
patch :update, params: {id: 1, project_id: 1, glossary_category: {name: 'Colour'}}
category = GlossaryCategory.find(1)
assert_redirected_to project_glossary_category_path(@project, category)
assert_equal 'Colour', category.name
end
end end