LogaJ
2/5/2015 - 10:36 AM

Timecop

Travelling and freezing with Timecop

context 'use Timecop to time TRAVEL below' do
  before do
    Timecop.travel(Time.now + 15.minutes + 1.second) do
      assigns(:next_action_owners)
    end
  end

  it 'place your expectations here' do
    expect(assigns(:next_action_owners)).to eql(%w(loga j))
  end

  after do
    Timecop.return
  end
end

context 'use Timecop to FREEZE time' do
  Timecop.freeze(Time.now + 15.minutes + 1.second) do
    it 'place your expectations here' do
      expect(assigns(:next_action_owners)).to eql(%w(loga j))
    end
  end

  after do
    Timecop.return
  end
end