Skip to content

Commit 1c4e61b

Browse files
committed
moved generic tag rename error message to locale strings
1 parent e85ecef commit 1c4e61b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

app/controllers/tags_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def rename
145145
render json: { status: 'success', tag: @tag }
146146
else
147147
render json: { status: 'failed',
148-
message: 'Failed to rename the tag.',
148+
message: I18n.t('tags.errors.rename_generic'),
149149
tag: @tag },
150150
status: :bad_request
151151
end

config/locales/strings/en.tags.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
en:
2+
tags:
3+
errors:
4+
rename_generic: >
5+
Failed to rename the tag.

test/controllers/tags_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class TagsControllerTest < ActionController::TestCase
207207
res_body = JSON.parse(response.body)
208208

209209
assert_equal 'failed', res_body['status']
210-
assert_no_nil res_body['message']
210+
assert_equal I18n.t('tags.errors.rename_generic'), res_body['message']
211211
tag.reload
212212
assert_equal tag.name, old_tag_name
213213
end

0 commit comments

Comments
 (0)