Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RSpec 3.2轨道安装式发动机的模型测试误差_Ruby On Rails_Ruby_Rspec_Rspec Rails - Fatal编程技术网

Ruby on rails RSpec 3.2轨道安装式发动机的模型测试误差

Ruby on rails RSpec 3.2轨道安装式发动机的模型测试误差,ruby-on-rails,ruby,rspec,rspec-rails,Ruby On Rails,Ruby,Rspec,Rspec Rails,在旧的RSpec中,在一个Rails可安装的引擎项目中,下面没有数据库。我们建立了以下期望 User.should_receive(:find_by_user_id_and_type).with(42, 'GREAT_USER').and_return(user) 上述措施效果良好 在rspec 3.2中,我们更改为 allow(User).to receive(:find_by_user_id_and_type).with(42, 'GREAT_USER').and_return(user)

在旧的RSpec中,在一个Rails可安装的引擎项目中,下面没有数据库。我们建立了以下期望

User.should_receive(:find_by_user_id_and_type).with(42, 'GREAT_USER').and_return(user)
上述措施效果良好

在rspec 3.2中,我们更改为

allow(User).to receive(:find_by_user_id_and_type).with(42, 'GREAT_USER').and_return(user)
现在失败,错误如下:

ActiveRecord::StatementInvalid: Could not find table 'users'
同样,该项目是一个Rails可装载引擎项目,数据库位于另一个将该项目用作库的项目中


提前感谢您的帮助。

如何定义
用户
?如何定义
用户