mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Remove message argument from NoteLengthValidator error approach (#37977)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
class NoteLengthValidator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, value)
|
||||
record.errors.add(attribute, :too_long, message: I18n.t('statuses.over_character_limit', max: options[:maximum]), count: options[:maximum]) if too_long?(value)
|
||||
record.errors.add(attribute, :too_long, count: options[:maximum]) if too_long?(value)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -91,7 +91,7 @@ RSpec.describe 'credentials API' do
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
error: /Validation failed/,
|
||||
details: include(note: contain_exactly(include(error: 'ERR_TOO_LONG', description: /character limit/)))
|
||||
details: include(note: contain_exactly(include(error: 'ERR_TOO_LONG', description: /too long/)))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ RSpec.describe 'Profile API' do
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
error: /Validation failed/,
|
||||
details: include(note: contain_exactly(include(error: 'ERR_TOO_LONG', description: /character limit/)))
|
||||
details: include(note: contain_exactly(include(error: 'ERR_TOO_LONG', description: /too long/)))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ RSpec.describe NoteLengthValidator do
|
||||
private
|
||||
|
||||
def too_long_message
|
||||
I18n.t('statuses.over_character_limit', max: 100)
|
||||
I18n.t('errors.messages.too_long', count: 100)
|
||||
end
|
||||
|
||||
def starting_string
|
||||
|
||||
Reference in New Issue
Block a user