[phase-18]Add edit/update action test for GlossaryCategoriesController
This commit is contained in:
parent
8e856ce4a4
commit
b9f410b0f6
@ -2,6 +2,7 @@ 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')
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user