Merge branch 'next-minor' into develop

This commit is contained in:
Dennis Schubert 2020-06-13 23:31:09 +02:00
commit 31b28e731d
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
3 changed files with 14 additions and 0 deletions

View file

@ -34,6 +34,7 @@ Although the chat was never enabled per default and was marked as experimental,
## Bug fixes
* Don't link to deleted users in admin user stats [#8063](https://github.com/diaspora/diaspora/pull/8063)
* Properly validate a profile's gender field length instead of failing with a database error. [#8127](https://github.com/diaspora/diaspora/pull/8127)
## Features

View file

@ -22,6 +22,7 @@ class Profile < ApplicationRecord
validates :first_name, :length => { :maximum => 32 }
validates :last_name, :length => { :maximum => 32 }
validates :location, :length => { :maximum =>255 }
validates :gender, length: {maximum: 255}
validates_format_of :first_name, :with => /\A[^;]+\z/, :allow_blank => true
validates_format_of :last_name, :with => /\A[^;]+\z/, :allow_blank => true

View file

@ -124,6 +124,18 @@ describe Profile, :type => :model do
end
end
describe "of gender" do
it "can be 255 characters long" do
profile = FactoryGirl.build(:profile, gender: "a" * 255)
expect(profile).to be_valid
end
it "cannot be 256 characters" do
profile = FactoryGirl.build(:profile, gender: "a" * 256)
expect(profile).not_to be_valid
end
end
describe "image_url setters" do
%i(image_url image_url_small image_url_medium).each do |method|
describe "##{method}=" do