我正在尝试总结我写Timecop
的shared_example
规范
describe "timecop wrapping shared example" do
Timecop.freeze(1.day.ago) do
it_behaves_like "a shared example i would like to test using timecop"
end
end
shared_examples "a shared example i would like to test using timecop"
before :all do
puts "the current time is #{Time.now}"
end
... expect ...
end
但是运行这个规范仍然使用实时而不是冻结的
Timecop可以这样工作吗?
我怎么能包装我的大块测试文件但改变它的运行时间