英文:
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?
英文:
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?
答案1
得分: 2
at
是一个类方法,通常用于将自纪元以来的秒数转换为一个时间对象。
Time.at(1) # 1969-12-31 16:00:01 -0800
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论