Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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 为什么启用颜色在Ruby';s rspec 3.0.3投掷一个NoMethodError?_Ruby On Rails_Ruby_Rspec_Rails Console - Fatal编程技术网

Ruby on rails 为什么启用颜色在Ruby';s rspec 3.0.3投掷一个NoMethodError?

Ruby on rails 为什么启用颜色在Ruby';s rspec 3.0.3投掷一个NoMethodError?,ruby-on-rails,ruby,rspec,rails-console,Ruby On Rails,Ruby,Rspec,Rails Console,我有一个名为mySpec的ruby规范文件。在spec文件中,我想在第37行运行一个特定的测试。但是,当我运行该测试时,我得到一个NoMethodError: $ rspec -v 3.0.3 $ bundle exec rspec myspec.rb:37 Coverage report generated for RSpec to coverage. 79 / 223 LOC (35.43%) covered. spec_helper.rb:10:in `block in <top

我有一个名为
mySpec
的ruby规范文件。在spec文件中,我想在第37行运行一个特定的测试。但是,当我运行该测试时,我得到一个
NoMethodError

$ rspec -v
3.0.3

$ bundle exec rspec myspec.rb:37
Coverage report generated for RSpec to coverage. 79 / 223 LOC (35.43%) covered.
spec_helper.rb:10:in `block in <top (required)>': undefined method `color_enabled=' for #<RSpec::Core::Configuration:0x007f905e2ea2c0> (NoMethodError)

那么为什么我找不到已启用的
color\u
?我尝试按照建议将
rspec-rails
rspec-console
添加到我的GEM文件中。但是这没有任何区别。

好吧,有
颜色启用了?
,但是没有
颜色启用了=
。试试这个:

RSpec.configure do |config|
  config.color = true
  config.tty = true
  config.order = "random"
end
RSpec.configure do |config|
  config.color = true
  config.tty = true
  config.order = "random"
end