Project

General

Profile

« Previous | Next » 

Revision fd06f4f6

Added by Tom Caspy over 8 years ago

fixes #11415 - using the correct method for classification caster

View differences:

app/services/classification/base.rb
end
def type_cast(key, value)
Foreman::Parameters::Caster.new(key, :attribute_name => :value, :to => key.key_type, :value => value).cast
Foreman::Parameters::Caster.new(key, :attribute_name => :default_value, :to => key.key_type, :value => value).cast
rescue TypeError
Rails.logger.warn "Unable to type cast #{value} to #{key.key_type}"
end
test/unit/classification_test.rb
end
end
test 'type cast allows nil values' do
key = FactoryGirl.create(:lookup_key)
assert_nothing_raised do
@classification.send(:type_cast, key, nil)
end
end
context 'lookup value type cast error' do
setup do
@lookup_key = mock('lookup_key')

Also available in: Unified diff