diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/controllers/admin/topics_controller_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/controllers/admin/topics_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/topics_controller_spec.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/controllers/admin/topics_controller_spec.rb b/spec/controllers/admin/topics_controller_spec.rb index ea510f916da..67943525687 100644 --- a/spec/controllers/admin/topics_controller_spec.rb +++ b/spec/controllers/admin/topics_controller_spec.rb @@ -77,24 +77,31 @@ RSpec.describe Admin::TopicsController do describe 'POST #create' do it 'creates topic' do expect do - post :create, params: { projects_topic: { name: 'test' } } + post :create, params: { projects_topic: { name: 'test', title: 'Test' } } end.to change { Projects::Topic.count }.by(1) end - it 'shows error message for invalid topic' do - post :create, params: { projects_topic: { name: nil } } + it 'shows error message for invalid topic name' do + post :create, params: { projects_topic: { name: nil, title: 'Test' } } errors = assigns[:topic].errors expect(errors).to contain_exactly(errors.full_message(:name, I18n.t('errors.messages.blank'))) end - it 'shows error message if topic not unique (case insensitive)' do - post :create, params: { projects_topic: { name: topic.name.upcase } } + it 'shows error message if topic name not unique (case insensitive)' do + post :create, params: { projects_topic: { name: topic.name.upcase, title: topic.title } } errors = assigns[:topic].errors expect(errors).to contain_exactly(errors.full_message(:name, I18n.t('errors.messages.taken'))) end + it 'shows error message for invalid topic title' do + post :create, params: { projects_topic: { name: 'test', title: nil } } + + errors = assigns[:topic].errors + expect(errors).to contain_exactly(errors.full_message(:title, I18n.t('errors.messages.blank'))) + end + context 'as a normal user' do before do sign_in(user) |