Navigation Menu

Skip to content

Commit

Permalink
testing reset methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillen committed Feb 1, 2012
1 parent 0d91bee commit a3702f8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/time_window_drop_collector/wrappers/rails_cache.rb
Expand Up @@ -18,7 +18,7 @@ def get( keys )
end

def reset
client.quit
client.reset
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/time_window_drop_collector/wrappers/redis.rb
Expand Up @@ -27,6 +27,10 @@ def get( keys )

result
end

def reset
client.quit
end
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/mock_wrapper_test.rb
Expand Up @@ -19,4 +19,10 @@ def test_values_for
wrapper.client.expects( :get_multi ).with( "keys" ).returns( "keys_values" )
assert_equal( "keys_values", wrapper.get( "keys" ))
end

def test_reset
wrapper = TimeWindowDropCollector::Wrappers::Mock.new( ["arg1"] )
wrapper.client.expects( :flush )
wrapper.reset
end
end
6 changes: 6 additions & 0 deletions test/rails_cache_wrapper_test.rb
Expand Up @@ -25,4 +25,10 @@ def test_values_for
wrapper.client.expects( :read_multi ).with( "keys" ).returns( "keys_values" )
assert_equal( "keys_values", wrapper.get( "keys" ))
end

def test_reset
wrapper = TimeWindowDropCollector::Wrappers::RailsCache.new( ["arg1"] )
wrapper.client.expects( :reset )
wrapper.reset
end
end
9 changes: 9 additions & 0 deletions test/redis_wrapper_test.rb
Expand Up @@ -47,4 +47,13 @@ def test_get

assert_equal( { "key1" => 1, "key2" => 2 }, wrapper.get( ["key1", "key2"] ))
end

def test_reset
client = mock
Redis.expects( :new ).returns( client )
wrapper = TimeWindowDropCollector::Wrappers::Redis.new( nil )
client.expects( :quit )
wrapper.reset
end

end

0 comments on commit a3702f8

Please sign in to comment.