Ruby on Rails Wednesday, February 18, 2015

Bingo!

It's returning the "travel_to" time.

Do you know why?

Thanks A LOT!!! 

Em Wed Feb 18 2015 at 7:20:47 AM, Colin Law <clanlaw@gmail.com> escreveu:
On 18 February 2015 at 01:03, Cezinha Anjos <cezinha.anjos@gmail.com> wrote:
> Hi!
>
> I have two projects running Rails 4.2 and using travel_to from
> ActiveSupport::Testing::TimeHelpers.
>
> In one project everything is working perfectly. But in the second one, my
> specs are running with the current date/time instead of using travel_to.
> Here is one example:
>
>   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
>
> I've already set the rails_helper.rb with:
>
> RSpec.configure do |config|
>   ...
>   config.include ActiveSupport::Testing::TimeHelpers
> end
>
> Does anyone know what's going on?

What do Time.current and Time.now give you inside the block?

Colin

--
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/CAL%3D0gLvHWzjwnoEirh09pBdTfCUA64OpoPvxJYkiYzih0pHW%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CACDeCpshotmnGntZc5g51bt2g%2BKcV6r_0%3DwV%2B2vJpAiy1Yz7zQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment