From f73c286ce9207e2fa85b12c594a620d5f2473ad3 Mon Sep 17 00:00:00 2001 From: Garret Alfert Date: Sat, 23 Jan 2016 12:34:08 -0500 Subject: [PATCH] Purge all keys from redis before every test run --- spec/spec_helper.rb | 6 ++++++ spec/swift/app_spec.rb | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 585725a..c92c47f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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 diff --git a/spec/swift/app_spec.rb b/spec/swift/app_spec.rb index 17d1555..9afbdf9 100644 --- a/spec/swift/app_spec.rb +++ b/spec/swift/app_spec.rb @@ -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"]