Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.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 3 Rails 3尝试将fixture/files文件夹中的文件作为fixture加载_Ruby On Rails 3_Testing - Fatal编程技术网

Ruby on rails 3 Rails 3尝试将fixture/files文件夹中的文件作为fixture加载

Ruby on rails 3 Rails 3尝试将fixture/files文件夹中的文件作为fixture加载,ruby-on-rails-3,testing,Ruby On Rails 3,Testing,我在一些测试中使用fixture_file_upload,文件位于fixture/files中 但是,每当我尝试运行测试时,Rails似乎都试图加载这些文件,就好像它们是固定装置一样,我最终会遇到如下错误: ActiveRecord::StatementInvalid: Mysql::Error: Table 'testapp_test.test_image' doesn't exist: DELETE FROM `test_image` 根据我收集的信息(以及我以前使用Rails版本的经验)

我在一些测试中使用fixture_file_upload,文件位于fixture/files中

但是,每当我尝试运行测试时,Rails似乎都试图加载这些文件,就好像它们是固定装置一样,我最终会遇到如下错误:

ActiveRecord::StatementInvalid: Mysql::Error: Table 'testapp_test.test_image' doesn't exist: DELETE FROM `test_image`

根据我收集的信息(以及我以前使用Rails版本的经验),它应该只加载fixtures目录根目录中的yml文件,但它加载的是所有内容。

添加对名称空间fixtures的支持使fixture\u文件上传半中断。以下是提交:

它应该只会妨碍CSV或YML文件,但这没有多大帮助。但由于fixture_file_upload现在只是Rack::Test::UploadedFile.new(ActionController::TestCase.fixture_path+path,type)的快捷方式,这就引出了解决方案


从“fixtures”下移出“files”并调用Rack::Test::UploadedFile.new直接对我起作用。

创建问题后,你发现了什么吗?我今天碰到了这个。烦人的