timecop

    0热度

    1回答

    我正在尝试为使用Sidetiq的Sidekiq作业编写一些测试,但似乎无法使其工作。我在sidetiq repo上发现了一个处理这个问题的问题,但是没有人回答它,所以我想我可以将它带到stackoverflow以获得一些答案和清晰度。 这里是链接到的问题:https://github.com/tobiassvn/sidetiq/issues/72 这里是将似乎没有工作代码: spec.rb # s

    0热度

    1回答

    我正在使用TimeCop Gem来测试对时间敏感的测试用例。 lib目录中有一个文件。它只包含字符串常量。 例子。 module DateStr SAMPLE = "Some date #{Date.current}" end 在我的黄瓜测试案例中,这部分代码没有得到模拟时间。它选择系统时间。这是为什么?

    0热度

    1回答

    定义 我有以下工厂: FactoryGirl.define do factory :task do due_date 7.days.from_now end end 在我的规格,我以这种方式使用时空特警: before do Timecop.freeze(Time.parse("Oct 5 2015")) end Time.now和Date.to

    0热度

    1回答

    我有一个大的rails测试套件,我只用了一次timecop。 it "should not include votes from today" do assert_equal 8, @answer.todays_score end it "should include today's votes tomorrow" do Timecop.travel(Date.today

    0热度

    1回答

    我试图总结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 e

    2热度

    1回答

    我正在使用timecop宝石来排除日期。我也使用factory_girl为了使我的规格创建对象更容易。 这里是我厂: FactoryGirl.define do factory :fiscal_year do start_date {Date.today} end_date {Date.today + 1.day} trait(:sequenced_sta

    0热度

    3回答

    任何人都可以提出为什么此规范使用Timecop 0.6.1和Ruby 2.0.0失败吗? (它通过使用时空特警0.4.5和1.9.3的Ruby) require 'timecop' require 'spec_helper' describe Class do it "freezes time" do Timecop.freeze Date.new(2012,7,1) d