Closed 645383 closed 11 months ago
Problem
attrs = {id: 123, user: {id: 234...}...} tweet = Twitter::Tweet.new(attrs) tweet.user.id # raises error NoMethodError: undefined method `id' for nil:NilClass
Expected It is expected to get NullObject in case if user can not be initialized:
NullObject
attrs = {id: 123, user: {id: 234...}...} tweet = Twitter::Tweet.new(attrs) tweet.user.id # should not raise an error and should return NullObject
Question How is it possible to get such an error?
Context
attrs
Thank you!
Problem
Expected It is expected to get
NullObject
in case if user can not be initialized:Question How is it possible to get such an error?
Context
attrs
passed to initialization are regular tweet attrs with regular user attrs.Thank you!