Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle string field names in CustomFieldList#respond_to? #606

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/netsuite/records/custom_field_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions spec/netsuite/records/custom_field_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading