Fixes #3762 - Unable to create a ticket in web app if default for additional boolean value is FALSE.
This commit is contained in:
parent
775709f7f2
commit
f9ffa3ef51
2 changed files with 9 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
class ObjectManager::Attribute::Validation::Required < ObjectManager::Attribute::Validation::Backend
|
class ObjectManager::Attribute::Validation::Required < ObjectManager::Attribute::Validation::Backend
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
return if value.present?
|
return if !value.nil?
|
||||||
return if optional_for_user?
|
return if optional_for_user?
|
||||||
|
|
||||||
invalid_because_attribute('is required but missing.')
|
invalid_because_attribute('is required but missing.')
|
||||||
|
|
|
@ -41,6 +41,14 @@ RSpec.describe ::ObjectManager::Attribute::Validation::Required do
|
||||||
}
|
}
|
||||||
end
|
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
|
context 'when action is edit' do
|
||||||
|
|
||||||
let(:action) { 'edit' }
|
let(:action) { 'edit' }
|
||||||
|
|
Loading…
Reference in a new issue