Purge all keys from redis before every test run

This commit is contained in:
Garret Alfert 2016-01-23 12:34:08 -05:00
parent 25c170021e
commit f73c286ce9
2 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,12 @@ def redis
@redis ||= Redis.new(host: app.settings.redis["host"], port: app.settings.redis["port"])
end
def purge_redis
redis.keys("*").each do |key|
redis.del key
end
end
if app.settings.respond_to? :riak
::Riak.disable_list_keys_warnings = true

View File

@ -13,6 +13,11 @@ describe "App" do
end
describe "PUT requests" do
before do
purge_redis
end
context "authorized" do
before do
redis.sadd "authorizations:phil:amarillo", [":rw"]
@ -59,6 +64,11 @@ describe "App" do
end
describe "DELETE requests" do
before do
purge_redis
end
context "authorized" do
before do
redis.sadd "authorizations:phil:amarillo", [":rw"]