Here is the basic idea of the spec:
before :each do
Timecop.freeze(Time.local(2012, 07, 01, 12, 0, 0)) #frozen at July 1st, 2012 at noon
#create record code
end
it 'shows how long ago the message was recieved' do
Timecop.travel(Time.local(2012, 07, 02, 12, 0, 0)) #move to July 2nd
page.should have_content "1 day ago"
end
after :each do
Timecop.return #release freeze
end
It errors out with:
expected there to be content "1 day ago" in "less than a minute ago"
I'm displaying <%= "#{time_ago_in_words(m.created_at)} ago" %>
which I would expect to be exactly 24 hours different. What am I missing?