mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
validate description max lenth
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
class Enterprise < ActiveRecord::Base
|
||||
TYPES = %w(full single profile)
|
||||
ENTERPRISE_SEARCH_RADIUS = 100
|
||||
|
||||
self.inheritance_column = nil
|
||||
|
||||
acts_as_gmappable :process_geocoding => false
|
||||
@@ -52,6 +51,7 @@ class Enterprise < ActiveRecord::Base
|
||||
validates :email, presence: true
|
||||
validates_presence_of :owner
|
||||
validate :enforce_ownership_limit, if: lambda { owner_id_changed? && !owner_id.nil? }
|
||||
validates_length_of :description, :maximum => 255
|
||||
|
||||
before_validation :ensure_owner_is_manager, if: lambda { owner_id_changed? && !owner_id.nil? }
|
||||
before_validation :set_unused_address_fields
|
||||
|
||||
@@ -86,6 +86,7 @@ describe Enterprise do
|
||||
subject { FactoryGirl.create(:distributor_enterprise, :address => FactoryGirl.create(:address)) }
|
||||
it { should validate_presence_of(:name) }
|
||||
it { should validate_presence_of(:email) }
|
||||
it { should validate_length_of(:description, :maximum => 255) }
|
||||
|
||||
it "requires an owner" do
|
||||
expect{
|
||||
|
||||
Reference in New Issue
Block a user