this spec is just refusing to work on jenkins

This commit is contained in:
Sam 2013-06-28 16:07:36 +10:00
parent ca6325a3fe
commit 1ec12fc808
2 changed files with 8 additions and 2 deletions

View File

@ -285,8 +285,9 @@ class User < ActiveRecord::Base
def update_last_seen!(now=nil)
now ||= Time.zone.now
now_date = now.to_date
# Only update last seen once every minute
redis_key = "user:#{self.id}:#{now_date.to_s}"
redis_key = "user:#{self.id}:last_seen"
if $redis.setnx(redis_key, "1")
$redis.expire(redis_key, SiteSetting.active_user_rate_limit_secs)

View File

@ -592,6 +592,7 @@ describe User do
before do
SiteSetting.stubs(:active_user_rate_limit_secs).returns(0)
SiteSetting.stubs(:previous_visit_timeout_hours).returns(1)
end
it "should act correctly" do
@ -601,6 +602,11 @@ describe User do
user.update_last_seen!(first_visit_date)
user.previous_visit_at.should be_nil
# updated same time
user.update_last_seen!(first_visit_date)
user.reload
user.previous_visit_at.should be_nil
# second visit
user.update_last_seen!(second_visit_date)
user.reload
@ -610,7 +616,6 @@ describe User do
user.update_last_seen!(third_visit_date)
user.reload
user.previous_visit_at.should be_within_one_second_of(second_visit_date)
end
end