Permalink
Browse files

Merge pull request #30 from iron-io/bugfix-clear-test-failed

Fixed clearing cache in basic tests
  • Loading branch information...
2 parents 925fde2 + 33ee184 commit 4326baef292c20685bea707f85c314ce0f4bd7a7 @treeder treeder committed Mar 14, 2013
Showing with 12 additions and 13 deletions.
  1. +6 −9 test/test_base.rb
  2. +6 −4 test/test_iron_cache.rb
View
@@ -30,15 +30,12 @@ def setup
end
- def clear_queue(queue_name=nil)
- #queue_name ||= @client.cache_name
- #puts "clearing queue #{queue_name}"
- #while res = @client.messages.get(:cache_name=>queue_name)
- # p res
- # puts res.body.to_s
- # res.delete
- #end
- #puts 'cleared.'
+ def clear_cache(cache_name=nil)
+ cache_name ||= @client.cache_name
+ puts "clearing cache #{cache_name}"
+ cache = @client.cache(cache_name)
+ cache.clear
+ puts 'cleared.'
end
def assert_performance(time)
View
@@ -9,7 +9,7 @@ def setup
def test_basics
@client.cache_name = 'test_basics'
- clear_queue
+ clear_cache
k = "key1"
v = "hello world!"
@@ -104,7 +104,7 @@ def test_caches
def test_expiry
@client.cache_name = 'test_basics'
- clear_queue
+ clear_cache
k = "key1"
v = "hello world!"
res = @client.items.put(k, v, :expires_in => 10)
@@ -121,7 +121,7 @@ def test_expiry
def test_incrementors
@client.cache_name = 'test_incrementors'
- clear_queue
+ clear_cache
k = "incr1"
v = 1
res = @client.items.put(k, v)
@@ -178,7 +178,7 @@ def test_size
def test_keys
@client.cache_name = 'test_keys'
- clear_queue
+ clear_cache
k = "word_count_[EBook"
v = "hello world!"
@@ -193,6 +193,8 @@ def test_keys
def test_clear
cache = @client.cache("test_clear_3")
+ cache.clear
+
num_items = 50
num_items.times do |i|

0 comments on commit 4326bae

Please sign in to comment.