Ruby on Rails Wednesday, February 18, 2015

On Tue, Feb 17, 2015 at 5:03 PM, Cezinha Anjos <cezinha.anjos@gmail.com> wrote:

> I have two projects running Rails 4.2 and using travel_to from
> ActiveSupport::Testing::TimeHelpers.

> it "is only a travel_to test" do
> travel_to Time.new(2012, 1, 1, 1, 1, 1) do
> expect(Time.new).to eq Time.new(2012, 1, 1, 1, 1, 1)
> end
> end

From the doc for `travel_to` --
Changes current time to the given time by stubbing Time.now and
Date.today to return the time or date passed into this method.

If you change your test to `expect(Time.now).to ...` it will pass.

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yB8sEWJGOPaR3%3DgJvFBe1_DMDRR9c8fcB%2Bs_ny8D-g8rA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment