ZimZimma
ZimZimma

Reputation: 228

Rspec test failing due to the undefined method "in" for a Date class instance

I'm attempting to test a method that uses the at method on a Date class instance.

ex: start_at = day.at(ordering_range.open_time)

and I get this error:

eval error: undefined method `at' for 2023-02-07 20:10:54.835826 -0500:Date

Event though at is instance method of Date outside of rspec

Is this an issue with rspec? Is it possible to test?

Upvotes: 0

Views: 158

Answers (1)

Schwern
Schwern

Reputation: 164829

at is a class method, it's generally used to convert from number of seconds since the epoch to a Time object.

Time.at(1)  # 1969-12-31 16:00:01 -0800 

Upvotes: 2

Related Questions