Fix tests and checklist item validation [SCI-4776]

This commit is contained in:
Oleksii Kriuchykhin 2020-07-03 14:11:56 +02:00
parent dc481cf236
commit 3af20c96c7
2 changed files with 3 additions and 3 deletions

View file

@ -5,7 +5,7 @@ class ChecklistItem < ApplicationRecord
length: { maximum: Constants::TEXT_MAX_LENGTH }
validates :checklist, presence: true
validates :checked, inclusion: { in: [true, false] }
validates :position, uniqueness: { scope: :checklist }
validates :position, uniqueness: { scope: :checklist }, unless: -> { position.nil? }
belongs_to :checklist,
inverse_of: :checklist_items

View file

@ -3,8 +3,8 @@
FactoryBot.define do
factory :tiny_mce_asset do
association :team, factory: :team
image do
fixture_file_upload(Rails.root.join('spec', 'fixtures', 'files', 'test.jpg'), 'image/jpg')
after(:create) do |tiny_mce_asset|
tiny_mce_asset.image.attach(io: File.open(Rails.root.join('spec/fixtures/files/test.jpg')), filename: 'test.jpg')
end
end
end