Fixes #3762 - Unable to create a ticket in web app if default for additional boolean value is FALSE.

This commit is contained in:
Rolf Schmidt 2021-09-22 13:57:53 +01:00
parent 775709f7f2
commit f9ffa3ef51
2 changed files with 9 additions and 1 deletions

View file

@ -3,7 +3,7 @@
class ObjectManager::Attribute::Validation::Required < ObjectManager::Attribute::Validation::Backend
def validate
return if value.present?
return if !value.nil?
return if optional_for_user?
invalid_because_attribute('is required but missing.')

View file

@ -41,6 +41,14 @@ RSpec.describe ::ObjectManager::Attribute::Validation::Required do
}
end
context 'when boolean field with false values' do
let(:value) { false }
let(:attribute) { build(:object_manager_attribute_boolean) }
let(:action) { 'create_middle' }
it_behaves_like 'a validation without errors'
end
context 'when action is edit' do
let(:action) { 'edit' }