Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/admin/topics_controller_spec.rb')
-rw-r--r--spec/controllers/admin/topics_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/admin/topics_controller_spec.rb b/spec/controllers/admin/topics_controller_spec.rb
index 6d66cb43338..ea510f916da 100644
--- a/spec/controllers/admin/topics_controller_spec.rb
+++ b/spec/controllers/admin/topics_controller_spec.rb
@@ -88,6 +88,13 @@ RSpec.describe Admin::TopicsController do
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 } }
+
+ errors = assigns[:topic].errors
+ expect(errors).to contain_exactly(errors.full_message(:name, I18n.t('errors.messages.taken')))
+ end
+
context 'as a normal user' do
before do
sign_in(user)
@@ -116,6 +123,15 @@ RSpec.describe Admin::TopicsController do
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
+ other_topic = create(:topic, name: 'other-topic')
+
+ put :update, params: { id: topic.id, projects_topic: { name: other_topic.name.upcase } }
+
+ errors = assigns[:topic].errors
+ expect(errors).to contain_exactly(errors.full_message(:name, I18n.t('errors.messages.taken')))
+ end
+
context 'as a normal user' do
before do
sign_in(user)