[phase-18]Add new/create action test for GlossaryCategoriesController

This commit is contained in:
Toru Takahashi 2018-08-10 05:10:46 +09:00 committed by TAKAHASHI,Toru
parent b9f410b0f6
commit ea7ada3027

View File

@ -30,4 +30,21 @@ class GlossaryCategoriesControllerTest < ActionController::TestCase
assert_redirected_to project_glossary_category_path(@project, category) assert_redirected_to project_glossary_category_path(@project, category)
assert_equal 'Colour', category.name assert_equal 'Colour', category.name
end end
def test_new
@request.session[:user_id] = users('users_002').id
get :new, params: {id: 1, project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_create
@request.session[:user_id] = users('users_002').id
post :create, params: {
project_id: 1, glossary_category: {name: 'Material'}
}
category = GlossaryCategory.find_by(name: 'Material')
assert_not_nil category
assert_redirected_to project_glossary_category_path(@project, category)
end
end end