rspec - Timecop and Ruby 2.0.0 -


can suggest why spec fails using timecop 0.6.1 , ruby 2.0.0?

(it passes using timecop 0.4.5 , ruby 1.9.3)

require 'timecop' require 'spec_helper'  describe class   "freezes time"     timecop.freeze date.new(2012,7,1)       expect(date.today).to eq(date.new 2012,7,1)     end   end end 

which results in:

$ rspec spec/models/time_cop_spec.rb   failures:    1) class freezes time      failure/error: expect(date.today).to eq(date.new 2012,7,1)         expected: sun, 01 jul 2012             got: thu, 02 may 2013         (compared using ==)         diff:        @@ -1,2 +1,2 @@        -sun, 01 jul 2012        +thu, 02 may 2013 

there clear , consise answer (and pull request fix it) on timecop's github repo.

short answer: change in bundler version, not change in ruby or timecop version, caused issue.

short solution: add require 'date' top (before require 'timecop').

thanks @micahchalmer :)


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -