diff --git a/HISTORY.md b/HISTORY.md index e689e70de..eedcc8839 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ ### Fixed * Revert recent proxy changes which breaks proxy usage by @andrewdicken-stripe in https://github.com/NetSweet/netsuite/pull/579 +* Handle string field names in `CustomFieldList#respond_to?` (#606) ### Breaking Changes diff --git a/lib/netsuite/records/custom_field_list.rb b/lib/netsuite/records/custom_field_list.rb index 193bb4b84..cc7267b4c 100644 --- a/lib/netsuite/records/custom_field_list.rb +++ b/lib/netsuite/records/custom_field_list.rb @@ -60,8 +60,8 @@ def method_missing(sym, *args, &block) super(sym, *args, &block) end - def respond_to?(sym, include_private = false) - return true if @custom_fields_assoc.include?(sym) + def respond_to?(method, include_private = false) + return true if @custom_fields_assoc.include?(method.to_sym) super end diff --git a/spec/netsuite/records/custom_field_list_spec.rb b/spec/netsuite/records/custom_field_list_spec.rb index 2266f51da..5122d0254 100644 --- a/spec/netsuite/records/custom_field_list_spec.rb +++ b/spec/netsuite/records/custom_field_list_spec.rb @@ -273,8 +273,14 @@ # field accessors are tested elsewhere, but let's run tests here to check various field types expect(list).to respond_to(:custbody_multipleselectfield) + expect(list).to respond_to('custbody_multipleselectfield') expect(list).to respond_to(:custbody_salesclassification) + expect(list).to respond_to('custbody_salesclassification') expect(list).to respond_to(:custentity_registeredonline) + expect(list).to respond_to('custentity_registeredonline') + + expect(list).to_not respond_to(:non_existant_field) + expect(list).to_not respond_to('non_existant_field') expect(list.to_record).to eql(record) expect(list.to_record.length).to eq(1)