Purge all keys from redis before every test run
This commit is contained in:
		
							parent
							
								
									25c170021e
								
							
						
					
					
						commit
						f73c286ce9
					
				@ -37,6 +37,12 @@ def redis
 | 
				
			|||||||
  @redis ||= Redis.new(host: app.settings.redis["host"], port: app.settings.redis["port"])
 | 
					  @redis ||= Redis.new(host: app.settings.redis["host"], port: app.settings.redis["port"])
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def purge_redis
 | 
				
			||||||
 | 
					  redis.keys("*").each do |key|
 | 
				
			||||||
 | 
					    redis.del key
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if app.settings.respond_to? :riak
 | 
					if app.settings.respond_to? :riak
 | 
				
			||||||
  ::Riak.disable_list_keys_warnings = true
 | 
					  ::Riak.disable_list_keys_warnings = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,11 @@ describe "App" do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "PUT requests" do
 | 
					  describe "PUT requests" do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    before do
 | 
				
			||||||
 | 
					      purge_redis
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context "authorized" do
 | 
					    context "authorized" do
 | 
				
			||||||
      before do
 | 
					      before do
 | 
				
			||||||
        redis.sadd "authorizations:phil:amarillo", [":rw"]
 | 
					        redis.sadd "authorizations:phil:amarillo", [":rw"]
 | 
				
			||||||
@ -59,6 +64,11 @@ describe "App" do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "DELETE requests" do
 | 
					  describe "DELETE requests" do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    before do
 | 
				
			||||||
 | 
					      purge_redis
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context "authorized" do
 | 
					    context "authorized" do
 | 
				
			||||||
      before do
 | 
					      before do
 | 
				
			||||||
        redis.sadd "authorizations:phil:amarillo", [":rw"]
 | 
					        redis.sadd "authorizations:phil:amarillo", [":rw"]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user