0
背景:所以我有大约(Ruby on Rails的应用程序)我可以使用什么RSpec的方式对这一要求
class A
def calculate_input_datetimes
# do stuff to calculate datetimes - then for each one identified
process_datetimes(my_datetime_start, my_datetime_end)
end
def process_datetimes(input_datetime_start, input_datetime_end)
# do stuff
end
end
所以:
- 我想测试calculate_input_datetimes算法正在 和计算正确的日期时间传递给process_datetimes
- 我知道我可以存根process_datetimes所以它的代码不会被 参与测试的
问题:我怎样才能设置但是RSpec的测试,所以我可以明确 测试正确datestimes已尝试传递到 process_datetimes,所以对于一个给定的规范测试process_datetimes是 所谓三( 3)次,通过以下参数说:
- 2012-03-03T00:00:00 + 00:00,2012-03-09T23:59:59 + 00:00
- 2012-03- 10T00:00:00 + 00:00,2012-03-16T23:59:59 + 00:00
- 2012-03-17T00:00:00 + 00:00,2012-03-23T23:59:59 + 00:00
感谢