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

Added respond_to_missing implementation so respond_to works as expected #73

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
6 changes: 5 additions & 1 deletion lib/netsuite/records/record_ref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def method_missing(m, *args, &block)
super
end
end


def respond_to_missing?(method_name, include_private = false)
attributes.keys.map(&:to_sym).include?(method_name.to_sym) || super
end

end
end
end
8 changes: 8 additions & 0 deletions spec/netsuite/records/record_ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
record_ref.name.should eql('This is a record_ref')
record_ref.banana.should eql('for monkeys')
end

it 'should have truthy result for respond_to existing attribute' do
record_ref.respond_to?(:name).should be_true
end

it 'should have false result for respond_to missing attribute' do
record_ref.respond_to?(:apple).should be_false
end
end
end

Expand Down