discourse/spec/models/user_visit_spec.rb

22 lines
410 B
Ruby
Raw Normal View History

2013-02-05 13:16:51 -06:00
require 'spec_helper'
describe UserVisit do
it 'can ensure consistency' do
u = Fabricate(:user)
u.update_visit_record!(2.weeks.ago.to_date)
u.last_seen_at = 2.weeks.ago
u.save
u.update_visit_record!(1.day.ago.to_date)
u.reload
u.days_visited.should == 2
u.days_visited = 1
2013-04-07 17:19:35 -05:00
u.save
UserVisit.ensure_consistency!
u.reload
u.days_visited.should == 2
end
2013-02-05 13:16:51 -06:00
end