DEV: Set limits for text fields on BadgeGrouping
This commit is contained in:
parent
1106e4ad09
commit
b81c13280a
|
@ -9,6 +9,9 @@ class BadgeGrouping < ActiveRecord::Base
|
||||||
|
|
||||||
has_many :badges
|
has_many :badges
|
||||||
|
|
||||||
|
validates :name, length: { maximum: 100 }
|
||||||
|
validates :description, length: { maximum: 500 }
|
||||||
|
|
||||||
def system?
|
def system?
|
||||||
id && id <= 5
|
id && id <= 5
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe BadgeGrouping, type: :model do
|
||||||
|
it { is_expected.to validate_length_of(:name).is_at_most(100) }
|
||||||
|
it { is_expected.to validate_length_of(:description).is_at_most(500) }
|
||||||
|
end
|
Loading…
Reference in New Issue