So I have some classes in a gem and I'm struggling to test specific lines in my code. The class Foo has two attributes, both of which are instances of classes User and Client. How can I test that Foo.get_events(date) calls the method Client.get_events(user, date)?
class Foo
attr_reader(:user, :client)
def get_events(date)
client.get_events(user[:id], date)
end
end
class Client
def get_events
# Makes API call here
end
end
I already have mocked requests for Client.get_events and that method is successfully tested, but I can't figure out how to test that Foo.get_events calls that method.
Thank you!