Browse Source

Fix a spuriously failing spec that assumed we required short bios like upstream

closed-social-glitch-2
Surinna Curtis 7 years ago
parent
commit
3cac5bc2c3
2 changed files with 6 additions and 2 deletions
  1. +3
    -1
      app/models/account.rb
  2. +3
    -1
      spec/controllers/api/v1/accounts/credentials_controller_spec.rb

+ 3
- 1
app/models/account.rb View File

@ -54,6 +54,8 @@ class Account < ApplicationRecord
include Remotable
include EmojiHelper
MAX_NOTE_LENGTH = 500
enum protocol: [:ostatus, :activitypub]
# Local users
@ -288,7 +290,7 @@ class Account < ApplicationRecord
note_without_metadata = note[(idx + YAML_END.length) .. -1]
end
end
if note_without_metadata.mb_chars.grapheme_length > 500n>
if note_without_metadata.mb_chars.grapheme_length > MAX_NOTE_LENGTH
errors.add(:note, "can't be longer than 500 graphemes")
end
end

+ 3
- 1
spec/controllers/api/v1/accounts/credentials_controller_spec.rb View File

@ -51,7 +51,9 @@ describe Api::V1::Accounts::CredentialsController do
describe 'with invalid data' do
before do
patch :update, params: { note: 'This is too long. ' * 10 }
note = 'This is too long. '
note = note + 'a' * (Account::MAX_NOTE_LENGTH - note.length + 1)
patch :update, params: { note: note }
end
it 'returns http unprocessable entity' do

Loading…
Cancel
Save