Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.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规范后未找到coverage/index.html_Ruby On Rails - Fatal编程技术网

Ruby on rails 运行rspec规范后未找到coverage/index.html

Ruby on rails 运行rspec规范后未找到coverage/index.html,ruby-on-rails,Ruby On Rails,包括 require 'simplecov' require 'simplecov-rcov' 在spec_helper.rb类中,运行rpec/spec。但是在运行完之后,当我导航到0.0.0.0:3000/coverage/index.html时,我发现了这个错误 路由错误 没有与[GET]“/coverage/index.html”匹配的路由 这里可能会出什么问题?提前感谢。将以下内容添加到您的GEM文件中: SimpleCov.start 'rails' 然后运行捆绑安装而不是将ur

包括

require 'simplecov'
require 'simplecov-rcov'
在spec_helper.rb类中,运行rpec/spec。但是在运行完之后,当我导航到0.0.0.0:3000/coverage/index.html时,我发现了这个错误

路由错误

没有与[GET]“/coverage/index.html”匹配的路由


这里可能会出什么问题?提前感谢。

将以下内容添加到您的
GEM文件中

SimpleCov.start 'rails'

然后运行
捆绑安装

而不是将url粘贴到浏览器中,尝试在终端中运行此操作:

gem 'simplecov'
gem 'simplecov-rcov'

有关更多详细信息,请参阅。

不确定simplecov是否与rails的行为不同,但我建议您在应用程序的根文件夹中查找coverage文件夹(如果使用版本控制,请查找已更改的文件)。如果你找到了,你可以在浏览器中打开index.html。它成功了!但是为什么这与在浏览器中输入URL不同?@intcreator,因为rails web服务器不是为您的覆盖率报告而设计的。(位于0.0.0.0:3000的rails web服务器旨在模拟公共web服务器,您可能不想向世界显示您的覆盖率报告。)通过运行“open coverage/index.html”,您的web浏览器将覆盖率报告作为本地文件打开,而不是通过rails web服务器。
open coverage/index.html