travisjeffery

timecop

travisjeffery

A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.

AI 简介

timecop 是一个 Ruby 宝石,提供了“时间旅行”、“时间冻结”和“时间加速”的功能,简化了依赖于时间的代码测试。其核心功能包括统一方法来模拟 `Time.now`、`Date.today` 和 `DateTime.now` 等时间相关对象,并且支持嵌套调用和多种时间参数格式。此外,它不依赖任何外部库,适用于所有 Ruby 项目,包括 Rails 应用。特别适合需要在特定时间点进行测试或验证时间敏感逻辑的场景,如金融交易、日历应用等。

Ruby
MIT License
3.4k
Stars
228
Forks
26
Watchers
6
Issues

Star 增长

今日+1
近 7 天+1
近 30 天+12
综合评分62.78
默认分支master