Sha256: 446847f65ad7b9801b6e47560a32550990420c156c5a937aa51c305da069f7cf

Contents?: true

Size: 672 Bytes

Versions: 13

Compression:

Stored size: 672 Bytes

Contents

module RspecRedisHelper
  RSpec.configure do |config|
    config.include RSpec::RedisHelper, redis: true

    # define custom method that flushdb instead of flushall
    def with_clean_redis_db(&block)
    	redis.client.disconnect
    	redis2.client.disconnect
    	redis.flushdb
    	begin
    		yield
    	ensure
    		redis.flushdb
    		redis.quit
    		redis2.quit
    	end
    end

    # clean the redis-helper gem's Redis database around each run
    config.around(:each, redis: true) do |example|
      $redis = redis
      with_clean_redis_db do
        # force the app to use the redis helper gem's Redis database
        example.run
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
config_manager-1.0.4 spec/support/rspec_redis_helper.rb
config_manager-1.0.3 spec/support/rspec_redis_helper.rb
config_manager-1.0.2 spec/support/rspec_redis_helper.rb
config_manager-1.0.0 spec/support/rspec_redis_helper.rb
config_manager-0.0.10 spec/support/rspec_redis_helper.rb
config_manager-0.0.9 spec/support/rspec_redis_helper.rb
config_manager-0.0.8 spec/support/rspec_redis_helper.rb
config_manager-0.0.7 spec/support/rspec_redis_helper.rb
config_manager-0.0.6 spec/support/rspec_redis_helper.rb
config_manager-0.0.5 spec/support/rspec_redis_helper.rb
config_manager-0.0.4 spec/support/rspec_redis_helper.rb
config_manager-0.0.2 spec/support/rspec_redis_helper.rb
config_manager-0.0.1 spec/support/rspec_redis_helper.rb