Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.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 使用Watir和未初始化的常量Watir::RSpec::Core_Ruby On Rails_Ruby_Rspec_Rubygems_Watir - Fatal编程技术网

Ruby on rails 使用Watir和未初始化的常量Watir::RSpec::Core

Ruby on rails 使用Watir和未初始化的常量Watir::RSpec::Core,ruby-on-rails,ruby,rspec,rubygems,watir,Ruby On Rails,Ruby,Rspec,Rubygems,Watir,我试图使用Watir创建一个自定义rspec格式化程序,但在执行该类时出现此错误。我以前从未用过瓦蒂尔。我需要一些特别的宝石吗 Error: uninitialized constant Watir::RSpec::Core (NameError) 我的代码: require 'rspec/core/formatters/html_formatter' module Watir class RSpec class CustomFormatter < RSpec::Core::

我试图使用Watir创建一个自定义rspec格式化程序,但在执行该类时出现此错误。我以前从未用过瓦蒂尔。我需要一些特别的宝石吗

Error: uninitialized constant Watir::RSpec::Core (NameError)
我的代码:

require 'rspec/core/formatters/html_formatter'
module Watir
  class RSpec
    class CustomFormatter < RSpec::Core::Formatters::HtmlFormatter

    end
  end
end
需要'rspec/core/formatters/html\u formatter'
模块瓦特
类RSpec
类CustomFormatter
发生异常是因为
CustomFormatter
试图从中继承的类。由于位置原因,需要在
Watir::RSpec
类的范围内查找
RSpec::Core::Formatters::HtmlFormatter

自定义格式化程序通常按以下方式执行:

require 'rspec/core/formatters/html_formatter'

class CustomFormatter < RSpec::Core::Formatters::HtmlFormatter
end
需要'rspec/core/formatters/html\u formatter'
类CustomFormatter

您不需要将其放入
Watir::RSpec
空间。

您试图使用Watir创建RSpec格式化程序是什么意思?Watir用于驱动浏览器,因此我不确定为什么它会用于创建rspec报告格式化程序。我不是在驱动浏览器,我正在测试一个应用程序,并尝试使用rspec格式化程序在浏览器上报告其结果。这个格式化程序不使用rspec显示屏幕截图,我知道Watir会显示,所以我们尝试了一下。由于我不了解ruby和rspec,如果您能通过屏幕截图分享一些关于测试报告的其他想法,我将不胜感激。:)我仍然不是100%确定你想做什么,但是你可能想看看这个。我试过了,但是有奇怪的事情发生了。如果我删除Watir::Rspec并运行formatter命令,所有测试所在的测试文件夹就会被删除。很奇怪,但是如果你以前遇到过类似的事情,请建议。我现在正在调查。顺便说一句,谢谢你的回复!!:)