Permalink
Browse files

count returns to zero on next day

  • Loading branch information...
1 parent c2a3993 commit 0ff38c05a66c1809f85384ae4c3616bba4428098 @stevenwilkin committed Feb 10, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 test/api/get_and_update_count_test.rb
@@ -8,6 +8,7 @@ class ApiGetAndUpdateCountTest < Test::Unit::TestCase
def setup
@valid_api_key = 'valid'
@now = Time.new(2012, 2, 9, 13, 20)
+ @tomorrow = Time.new(2012, 2, 10, 13, 20)
$redis.flushdb
$redis.sadd 'api_keys', @valid_api_key
@@ -39,4 +40,11 @@ def test_count_increases_after_post
get '/api'
assert_equal '1', last_response.body, 'Should increase count after POST'
end
+
+ def test_count_is_back_to_zero_on_next_day
+ post '/api'
+ Timecop.freeze(@tomorrow)
+ get '/api'
+ assert_equal '0', last_response.body, 'Should return zero'
+ end
end

0 comments on commit 0ff38c0

Please sign in to comment.