我在使用Redis的模块在Rails 5中使用Rspec运行我的测试时出现问题。当我运行rails服务器时,一切正常。每当我运行Rspec的命令,我收到以下错误:尝试在使用Redis的模块上运行Rspec时出错
/Users/reinierverbeek/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/cache.rb:106:in `rescue in retrieve_store_class': Could not find cache store adapter for redis_store (cannot load such file -- active_support/cache/redis_store) (RuntimeError)
from /Users/reinierverbeek/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/cache.rb:104:in `retrieve_store_class'
我Redis的对象是在初始化文件初始化如下:
$redis = Redis::Namespace.new("ghanagana", :redis => Redis.new)
在配置文件中我有以下行:
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache'
编辑:我正在指定端口上Redis的服务器
在开始测试之前,您还需要运行redis服务器。 –