2016-07-19 67 views
0

我在使用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的服务器

+0

在开始测试之前,您还需要运行redis服务器。 –

回答

0

你必须在你的Gemfile宝石redis-store,你需要在环境中的文件或某些特定的测试文件中添加此

require 'redis-server' 

。 此外,请确保您已通过redis url运行Redis服务器。

如果它适合你,你也可以检查这个菌落。 Could not find cache store adapter for memory_store

+0

这不能解决问题,不幸的是,错误仍然相同 – Reinier

+0

链接的解决方案为我工作。 –

相关问题