perf(dossier): remove unused row validation
Gain, one request per champ not child
This commit is contained in:
parent
c207474c8c
commit
ac0ac171ad
2 changed files with 0 additions and 12 deletions
|
@ -78,8 +78,6 @@ class Champ < ApplicationRecord
|
||||||
before_save :normalize
|
before_save :normalize
|
||||||
after_update_commit :fetch_external_data_later
|
after_update_commit :fetch_external_data_later
|
||||||
|
|
||||||
validates :type_de_champ_id, uniqueness: { scope: [:dossier_id, :row] }
|
|
||||||
|
|
||||||
def public?
|
def public?
|
||||||
!private?
|
!private?
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,16 +16,6 @@ describe Champ do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "validations" do
|
|
||||||
let(:row) { 1 }
|
|
||||||
let(:champ) { create(:champ, type_de_champ: create(:type_de_champ), row: row) }
|
|
||||||
let(:champ2) { build(:champ, type_de_champ: champ.type_de_champ, row: champ.row, dossier: champ.dossier) }
|
|
||||||
|
|
||||||
it "returns false when champ with same type_de_champ and row already exist" do
|
|
||||||
expect(champ2).not_to be_valid
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "normalization" do
|
describe "normalization" do
|
||||||
it "should remove null bytes before save" do
|
it "should remove null bytes before save" do
|
||||||
champ = create(:champ, value: "foo\u0000bar")
|
champ = create(:champ, value: "foo\u0000bar")
|
||||||
|
|
Loading…
Reference in a new issue